例34:窗体增加20宽度

  1. 建立一个EXE工程,在窗体上放一个标签。
  2. 输入代码:
Sub Form1_WM_LButtonUp(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)

   Me.Width=Me.Width+20'Me代指本窗体

 End Sub

Sub Form1_Label1_WM_LButtonDown(hWndForm As hWnd, MouseFlags As Long, xPos As Long, yPos As Long)

     count=count+1

     Label1.Caption="继续点,你已点了我" & Str(count) & "次"

End Sub
  1. 程序运行后每单击一次窗体就会在标签上显示计数,同时窗体加宽20个像素,如图30。

例34:窗体增加20宽度_第1张图片             图30

你可能感兴趣的:(Visual,Free,Basic例解教程,开发语言)