- 建立一个EXE工程,在窗体上放一个标签。
- 输入代码:
Sub Form1_WM_LButtonUp(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)Me.Width=Me.Width+20'Me代指本窗体End SubSub Form1_Label1_WM_LButtonDown(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)count=count+1Label1.Caption="继续点,你已点了我" & Str(count) & "次"End Sub
- 程序运行后每单击一次窗体就会在标签上显示计数,同时窗体加宽20个像素,如图30。
图30