Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim k As String
Select Case Button
Case 1
k = "左键按下了"
Case 2
k = "右键按下了"
Case Else
k = "没键按下"
End Select
k = k & Chr(10) & X & Chr(10) & Y
Label1.Caption = k
我试了这种方法为什么不行啊,不明白,请高手指点。
Private Sub lblcaption_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim msg As Long
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
mouseState = True
Case WM_LBUTTONUP
mouseState = False
End Select
End Sub
Private Sub tmrChkStatus_Timer()
Dim lonCStat As Long
Dim lonCurrhWnd As Long
tmrChkStatus.Enabled = False
lonCStat = GetCursorPos(mpoiCursorPos)
lonCurrhWnd = WindowFromPoint(mpoiCursorPos.X, mpoiCursorPos.Y)
If mbooButtonLighted = False Then
If lonCurrhWnd = UserControl.hWnd Then
mbooButtonLighted = True
If mmodButtonMode = [Text Only Mode] Then
UserControl.BackColor = molcSelColor
ElseIf mmodButtonMode = [Image Mode] Then
Set UserControl.Picture = mpicSelPicture
Else
ShowLine True
If mouseState Then '***********当鼠标在label上按下时***********
Call OnLable(0)
Else
Call OnLable(1) '*****当鼠标在label上抬起时,*****
End If
DoEvents
End If
End If
RaiseEvent StatusChanged(1)
Else
If lonCurrhWnd <> UserControl.hWnd Then
mbooButtonLighted = False
If mmodButtonMode = [Text Only Mode] Then
UserControl.BackColor = molcBackColor
ElseIf mmodButtonMode = [Image Mode] Then
UserControl.Picture = mpicPicture
Else
ShowLine False
DoEvents
End If
End If
RaiseEvent StatusChanged(0)
End If
tmrChkStatus.Enabled = True