End Sub 需要一个CommandButton和一个Timer。 试试这个吧!不过,你的要求是在太模糊,用这种方法,还可以点击窗体上的其他控件、还可以移动窗体、还可以变化窗体....
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As LongPrivate Sub Command1_Click() ShowCursor 0 'Wait 5 seconds t = Timer Do: DoEvents: Loop Until Timer > t + 5 'Show the cursor ShowCursor 1 End Sub
试试这么做: 放入一个Timer控件 Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long '用来获取当前鼠标位置Public Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long '用来设置鼠标位置Private Type POINT x As Long y As long End TypeDim OldPoint As POINT '记录鼠标先前的位置Dim MouseStop as BooleanPrivate Sub Form_Load() MouseStop=Not MouseStop Timer1.Interval=10 Timer1.Enabled=False End SubPrivate Sub Form_Click() '放在别的事件里也行 MousePointer=vbDefault '设置鼠标的指针样式 GetCursorPos OldPoint '记录鼠标的位置 Timer1.Enabled=True '启动时钟 End Sub Private Sub Timer1.Timer() Dim NewX As Integer Dim NewY As integerMousePointer=vbDefault NewX=OldPoint.X NewY=OldPoint.Y SetCursorPos NewX,NewY End Sub
对象的click事件里只有一个判断语句,判断全局变量,是真就执行语句,是假就End Sub
Private Sub Command1_Click() Me.Print "现在开始,鼠标失效!"
Timer1.Enabled = TrueEnd SubPrivate Sub Form_Click()
If iKK <> 10 Then Exit Sub
Timer1.Enabled = False
Me.Cls
Me.Print "现在开始,鼠标有效!"
End SubPrivate Sub Form_Load()
Me.AutoRedraw = True
Command1.Caption = "开始"
Timer1.Enabled = False
Timer1.Interval = 10000
iKK = 0
End SubPrivate Sub Timer1_Timer()
iKK = iKK + 1
End Sub 需要一个CommandButton和一个Timer。 试试这个吧!不过,你的要求是在太模糊,用这种方法,还可以点击窗体上的其他控件、还可以移动窗体、还可以变化窗体....
ShowCursor 0
'Wait 5 seconds
t = Timer
Do: DoEvents: Loop Until Timer > t + 5
'Show the cursor
ShowCursor 1
End Sub
: dbcontrols 拜托,老乡,为什么老不看清人家的要求呢??“ 鼠标还得是显示的”!!
放入一个Timer控件
Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long '用来获取当前鼠标位置Public Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long '用来设置鼠标位置Private Type POINT
x As Long
y As long
End TypeDim OldPoint As POINT '记录鼠标先前的位置Dim MouseStop as BooleanPrivate Sub Form_Load()
MouseStop=Not MouseStop
Timer1.Interval=10
Timer1.Enabled=False
End SubPrivate Sub Form_Click() '放在别的事件里也行
MousePointer=vbDefault '设置鼠标的指针样式
GetCursorPos OldPoint '记录鼠标的位置
Timer1.Enabled=True '启动时钟
End Sub
Private Sub Timer1.Timer()
Dim NewX As Integer
Dim NewY As integerMousePointer=vbDefault
NewX=OldPoint.X
NewY=OldPoint.Y
SetCursorPos NewX,NewY
End Sub
在鼠标事件中判断鼠标指针是否为所指定的,如果是就exit sub.
在鼠标事件中判断鼠标指针是否为所指定的,如果是就exit sub.