- 建立一个EXE工程,在默认窗体上放一个文本框,设多行有效,再放一个标签。
- 在标签的鼠标按下,鼠标抬起,双击事件中分别输入代码,当这些事件发生时会在文本框中显示对应事件发生的文字提示。如图42.
图42
- 代码如下:
Sub Form1_Label1_WM_LButtonDown(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)
Text1.Text=Text1.Text & "MouseDown事件" & vbCrLf
End Sub
Sub Form1_Label1_WM_LButtonUp(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)
Text1.Text=Text1.Text & "MouseUp事件" & vbCrLf
End Sub
Sub Form1_Label1_WM_LButtonDblclk(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)
Text1.Text=Text1.Text & "MouseDblClick事件" & vbCrLf
End Sub