'添加一个标签(Label1),一个时钟控件(Timer1),一个按钮(Command1)
Dim t As Integer
Private Sub Command1_Click()
t = Val(InputBox("输入时间(分钟)"))
Label1Caption = t & "分钟"
Timer1Enabled = True
End Sub
Private Sub Form_Load()
Label1Caption = "-分钟"
Timer1Interval = 60000
Timer1Enabled = False
End Sub
Private Sub Timer1_Timer()
t = t - 1
Label1Caption = t & "分钟"
If t = 0 Then
Timer1Enabled = False
MsgBox "时间到!"
End If
End Sub
这一种是当你的鼠标想去点击按钮1时就会随机跑动,不让人可以点到。
Dim CMD1 As Boolean'设置一个全局布尔变量
Private Sub Command1_Click()
CMD1 = True
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If CMD1 = True Then
X = Rnd (Form1ScaleWidth - Command1Width)
Y = Rnd (Form1ScaleHeight - Command1Height)
Command1Move X, Y
End If
End Sub
Private Sub Command2_Click()
CMD1 = False
End Sub
这一种是你点了按钮1后,这个接钮1就不停的去跑动让人很难点到。
Private Sub Form_Load()
Timer1Interval = 100
Timer1Enabled = False
End Sub
Private Sub Command1_Click()
Timer1Enabled = True
End Sub
Private Sub Command2_Click()
Timer1Enabled = False
End Sub
Private Sub Timer1_Timer()
Command1Top = MeScaleHeight Rnd
Command1Left = MeScaleWidth Rnd
End Sub
这两种方法的区别在于点击按钮1后,
第一种是你的鼠标是永远都点不到按钮1。
第二种是你有可能会点中。
Option Explicit
Private Sub Command1_Click() '通过对话框选择装载到Image1图像框
CDlgFileName = ""
CDlgShowOpen
If CDlgFileName <> "" Then
Image1Picture = LoadPicture(CDlgFileName)
End If
End Sub
Private Sub Command2_Click()
Data1RecordsetAddNew '新增记录
End Sub
Private Sub Command3_Click()
With Data1Recordset
Delete '删除记录
MoveNext '移动记录指针到下一条记录
If EOF Then MoveLast 'EOF 指示当前记录位置位于 Recordset 对象的最后一个记录之后
End With
End Sub
Private Sub Command4_Click()
Dim s As String
With Data1Recordset
s = Bookmark '返回唯一标识 Recordset 对象中当前记录的书签,或者将 Recordset 对象的当前记录设置为由有效书签所标识的记录。
FindFirst Text4Text
If NoMatch Then
MsgBox "数据未找到"
Bookmark = s
End If
End With
End Sub
Private Sub Command5_Click()
Dim s As String
With Data1Recordset
s = Bookmark
FindNext Text4Text
If NoMatch Then
MsgBox "数据未找到"
Bookmark = s
End If
End With
End Sub
Private Sub Form_Load()
Data1DatabaseName = AppPath & "\MyDatamdb" '加在相对路径下MyDatamdb数据库
End Sub
Private Sub Label2_Click()
End Sub
欢迎分享,转载请注明来源:表白网
评论列表(0条)