⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vbclip.txt

📁 本地网监控客户端程序原码
💻 TXT
字号:
Checked Property Example

This example displays and removes a check mark next to a menu item.  To try this example, create a form with a Menu control that has one menu item (set both the Caption and Name properties to MyMenuItem), and then press F5 and choose the menu item.



Private Sub MyMenuItem_Click ()
	' Turn check mark on menu item on and off.
	MyMenuItem.Checked = Not MyMenuItem.Checked
End Sub


Private Sub cmdStartStop_Click()
' Declare local variables.
Dim UnClone
Dim MakeClone
Dim X1
Dim Y1
    Select Case DoFlag
        Case True
            cmdStartStop.Caption = "Start Demo"
            DoFlag = False
            mnuOption.Enabled = True
            If mnuCtlMoveDemo.Checked = True Then
                ' Hide bouncing graphic again.
                picBall.Visible = False
            ElseIf mnuLineDemo.Checked = True Then
                ' Remove lines from the form.
                Cls
            ElseIf mnuShapeDemo.Checked = True Then
                ' Remove all dynamically loaded Shape controls.
                For UnClone = 1 To 20
                    Unload shpClone(UnClone)
                Next UnClone
                ' Reset background color of form to black.
                DemoForm.BackColor = QBColor(0)
                ' Refresh form so color change takes effect.
                Refresh
            ElseIf mnuPSetDemo.Checked = True Then
                ' Remove confetti bits from form.
                Cls
            ElseIf mnuLineCtlDemo.Checked = True Then
                ' Hide Line control again.
                linLineCtl.Visible = False
                ' Remove any stray pixels left after hiding line.
                Cls
            ElseIf mnuImageDemo.Checked = True Then
                ' Hide bouncing graphic again.
                imgMoon(0).Visible = False
            ElseIf mnuScaleDemo.Checked = True Then
                ' Clear the form.
                Cls
                ' Return form to the default scale.
                Scale
            ElseIf mnuCircleDemo.Checked = True Then
                ' Remove the circles from the form.
                Cls
            End If
        Case False
            cmdStartStop.Caption = "Stop Demo"
            DoFlag = True
            mnuOption.Enabled = False
            If mnuCtlMoveDemo.Checked = True Then
                ' Make the bouncing graphic (picture box control) visible.
                picBall.Visible = True
                ' Determine initial motion of bouncing graphic at random.
                ' Settings are 1 to 4.  The value of the Motion variable determines
                ' what part of the Do Loop routine runs.
                Motion = Int(4 * Rnd + 1)
            ElseIf mnuLineDemo.Checked = True Then
                ' Initialize the random-number generator.
                Randomize
                ' Set the line width.
                DrawWidth = 2
                ' Set the initial X- and Y-coordinates to a random location on the form.
                X1 = Int(DemoForm.Width * Rnd + 1)
                Y1 = Int(DemoForm.Height * Rnd + 1)
            ElseIf mnuShapeDemo.Checked = True Then
                ' Dynamically load a control array of 20 shape controls on the form.
                For MakeClone = 1 To 20
                    Load shpClone(MakeClone)
                Next MakeClone
            ElseIf mnuPSetDemo.Checked = True Then
                ' Set the thickness of the confetti bits.
                DrawWidth = 5
            ElseIf mnuLineCtlDemo.Checked = True Then
                ' Make the line control visible.
                linLineCtl.Visible = True
                ' Set thickness of the line as it will appear.
                DrawWidth = 7
            ElseIf mnuImageDemo.Checked = True Then
                ' Make the bouncing graphic (image control) visible.
                imgMoon(0).Visible = True
                ' Set initial animation frame.
                FrameNum = 0
                ' Determine the initial motion of the bouncing graphic at random.
                ' Settings are 1 to 4.  The Value of the Motion variable determines
                ' what part of the Do Loop routine runs.
                Motion = Int(4 * Rnd + 1)
            ElseIf mnuScaleDemo.Checked = True Then
                ' Initialize the random-number generator.
                Randomize
                ' Set the width of the box outlines so boxes don't overlap.
                DrawWidth = 1
                ' Set the value of the X-coordinate to the left edge of form.
                ' Set the first box's X-coordinate = 1, second box = 2, and so on.
                ScaleLeft = 1
                ' Set the Y-coordinate of top edge of form to 10.
                ScaleTop = 10
                ' Set the number of units of the form width to a random number between
                ' 3 and 12.  This changes the number of boxes drawn each time the
                ' routine starts.
                ScaleWidth = Int(13 * Rnd + 3)
                ' Set the number of units in the form height to -10.  Then the height of all boxes
                ' varies from 0 to 10, and Y-coordinates start at the bottom of the form.
                ScaleHeight = -10
            ElseIf mnuCircleDemo.Checked = True Then
                ' Define the width of the circle outline.
                DrawWidth = 1
                ' Draw circles as dashed lines.
                DrawStyle = vbDash
                ' Draw lines using the XOR pen, combining colors found in the pen or
                ' in the display, but not in both.
                DrawMode = vbXorPen
            End If
    End Select
End Sub

Private Sub CtlMoveDemo()
    Select Case Motion
    Case 1
        ' Move the graphic left and up by 20 twips using the Move method.
        picBall.Move picBall.Left - 20, picBall.Top - 20
        ' If the graphic reaches the left edge of the form, move it to the right and up.
        If picBall.Left <= 0 Then
            Motion = 2
        ' If the graphic reaches the top edge of the form, move it to the left and down.
        ElseIf picBall.Top <= 0 Then
            Motion = 4
        End If
    Case 2
        ' Move the graphic right and up by 20 twips.
        picBall.Move picBall.Left + 20, picBall.Top - 20
        ' If the graphic reaches the right edge of the form, move it to the left and up.
        ' Routine determines the right edge of the form by subtracting the graphic
        ' width from the form width.
        If picBall.Left >= (DemoForm.Width - picBall.Width) Then
            Motion = 1
        ' If the graphic reaches the top edge of the form, move it to the right and down.
        ElseIf picBall.Top <= 0 Then
            Motion = 3
        End If
    Case 3
        ' Move the graphic right and down by 20 twips.
        picBall.Move picBall.Left + 20, picBall.Top + 20
        ' If the graphic reaches the right edge of the form, move it to the left and down.
        If picBall.Left >= (DemoForm.Width - picBall.Width) Then
            Motion = 4
        ' If the graphic reaches the bottom edge of the form, move it to the right and up.
        ' Routine determines the bottom of the form by subtracting
        ' the graphic height from the form height less 680 twips for the height
        ' of title bar and menu bar.
        ElseIf picBall.Top >= (DemoForm.Height - picBall.Height) - 680 Then
            Motion = 2
        End If
    Case 4
        ' Move the graphic left and down by 20 twips.
        picBall.Move picBall.Left - 20, picBall.Top + 20
        ' If the graphic reaches the left edge of the form, move it to the right and down.
        If picBall.Left <= 0 Then
            Motion = 3
        ' If the graphic reaches the bottom edge of the form, move it to the left and up.
        ElseIf picBall.Top >= (DemoForm.Height - picBall.Height) - 680 Then
            Motion = 1
        End If
    End Select
End Sub

Private Sub Delay()
    Dim Start
    Dim Check
    Start = Timer
    Do Until Check >= Start + 0.15
        Check = Timer
    Loop
End Sub

Private Sub Form_Resize()
    If mnuScaleDemo.Checked = True And DemoForm.WindowState = 0 Then
        ' Initialize the random-number generator.
        Randomize
        ' Set the width of the box outlines to narrow so the boxes don't overlap.
        DrawWidth = 1
        ' Set the value of the X-coordinate of the left edge of the form to 1.
        ' This makes it easy to set the position for each box.  The first box has
        ' an X-coordinate of 1, the second has an X-coordinate of 2, and so on.
        ScaleLeft = 1
        ' Set the value of the Y-coordinate of the top edge of the form to 10.
        ScaleTop = 10
        ' Set the number of units in the width of the form to a random number between
        ' 3 and 12.  This changes the number of boxes that are drawn each time the user
        ' starts this routine.
        ScaleWidth = Int(13 * Rnd + 3)
        ' Set the number of units in the height of the form to -10.  This has
        ' two effects.  First, all the boxes then have a height that varies from 0 to 10.
        ' Second, the negative value causes the Y-coordinates to begin at the bottom
        ' edge of the form instead of at the top.
        ScaleHeight = -10
    End If
End Sub

Private Sub ImageDemo()
    Select Case Motion
    Case 1
        ' Move the graphic to the left and up by 100 twips using the Move method.
        imgMoon(0).Move imgMoon(0).Left - 100, imgMoon(0).Top - 100
        ' Increment animation to next frame.
        IncrFrame
        ' If the graphic reaches the left edge of the form, move right and up.
        If imgMoon(0).Left <= 0 Then
            Motion = 2
        ' If the graphic reaches the top edge of the form, move left and down.
        ElseIf imgMoon(0).Top <= 0 Then
            Motion = 4
        End If
    Case 2
        ' Move the graphic right and up by 100 twips.
        imgMoon(0).Move imgMoon(0).Left + 100, imgMoon(0).Top - 100
        ' Increment animation to next frame.
        IncrFrame
        ' If the graphic reaches the right edge of the form, move left and up.
        ' Routine determines the right edge of the form by subtracting
        ' the graphic width from the control width.
        If imgMoon(0).Left >= (DemoForm.Width - imgMoon(0).Width) Then
            Motion = 1
        ' If the graphic reaches the top edge of the form, move right and down.
        ElseIf imgMoon(0).Top <= 0 Then
            Motion = 3
        End If
    Case 3
        ' Move the graphic right and down by 100 twips.
        imgMoon(0).Move imgMoon(0).Left + 100, imgMoon(0).Top + 100
        ' Increment animation to next frame.
        IncrFrame
        ' If the graphic reaches the right edge of the form, move left and down.
        If imgMoon(0).Left >= (DemoForm.Width - imgMoon(0).Width) Then
            Motion = 4
        ' If the graphic reaches bottom edge of form, move right and up.
        ' Routine determines the bottom edge of the form by subtracting the graphic
        ' height from the form height minus 680 twips for the height of the title
        ' bar and menu bar.
        ElseIf imgMoon(0).Top >= (DemoForm.Height - imgMoon(0).Height) - 680 Then
            Motion = 2
        End If
    Case 4
        ' Move the graphic left and down by 100 twips.
        imgMoon(0).Move imgMoon(0).Left - 100, imgMoon(0).Top + 100
        ' Increment animation to next frame.
        IncrFrame
        ' If the graphic reaches the left edge of the form, move right and down.
        If imgMoon(0).Left <= 0 Then
            Motion = 3
        ' If the graphic reaches the bottom edge of the form, move left and up.
        ElseIf imgMoon(0).Top >= (DemoForm.Height - imgMoon(0).Height) - 680 Then
            Motion = 1
        End If
    End Select
End Sub

Private Sub Form_Load()
  On Error Resume Next

  Dim sDir As String
 
  sDir = CurDir
  
  dcAuthorTitles.DatabaseName = sDir & "\biblio.mdb"
  dcAuthorTitles.Refresh
  'if vb was launched from the app dir, then
  'we need to look for the mdb 2 levels back
  If Err Then
    sDir = "..\.."
    dcAuthorTitles.DatabaseName = sDir & "\biblio.mdb"
    dcAuthorTitles.Refresh
  End If
  dcPubsTitles.DatabaseName = sDir & "\biblio.mdb"
  dcPubsTitles.Refresh
  dcTitleAuthors.DatabaseName = sDir & "\biblio.mdb"
  dcTitleAuthors.Refresh
  dbCtrl(0).DatabaseName = sDir & "\biblio.mdb"
  dbCtrl(0).Refresh
  dbCtrl(1).DatabaseName = sDir & "\biblio.mdb"
  dbCtrl(1).Refresh
  dbCtrl(2).DatabaseName = sDir & "\biblio.mdb"
  dbCtrl(2).Refresh
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -