vb 怎样吸附在窗口的最左边?

来源:百度知道 编辑:UC知道 时间:2024/07/05 05:01:37
点击按钮之后怎样窗口自动吸附在最左边,并且像qq那样缩进去.

Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim fw As Single
Private Sub Command1_Click()
Me.Left = 0
fw = Me.Width
Me.Width = 1
End Sub

Private Sub Form_Load()
Timer1.Interval = 1
End Sub

Private Sub Timer1_Timer()
Dim sb As POINTAPI, a As Long
DoEvents
a = GetCursorPos(sb)
If sb.x <= 2 Then
If Me.Width < fw Then
Me.Width = Me.Width + 100
Else
Me.Width = fw
End If
End If
End Sub

要添加一个comman 和一个timer
form的边框要设为无

学习下