'窗体部分
Option Explicit
Private Sub Form_Resize() '单步调试这个过程
Me.Show
On Error Resume Next
Label2.Top = 5
Label2.Left = 15
'***********************************************************************
leftup.Top = 0
leftup.Left = 0
uppe.Top = 0
uppe.Left = 15
uppe.Width = Me.ScaleWidth - 30
rightup.Left = Me.ScaleWidth - 15
rightup.Top = 0
right.Left = Me.ScaleWidth - 15 '包装边框
right.Top = 15
right.Height = Me.ScaleHeight - 30
rightdown.Left = Me.ScaleWidth - 15
rightdown.Top = Me.ScaleHeight - 15
down.Top = Me.ScaleHeight - 15
down.Left = 15
down.Width = Me.ScaleWidth - 30
leftdown.Left = 0
leftdown.Top = Me.ScaleHeight - 15
leftpic.Left = 0
leftpic.Top = 15
leftpic.Height = Me.ScaleHeight - 30
'***********************************************************************
ShapeTheForm Me '设置形状
End Sub
'***********************************************************************
' 窗体和控件移动
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrapWindow
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrapWindow
End Sub
Private Sub Label2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrapWindow
End Sub
Private Sub Label4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrapWindow
End Sub
'***********************************************************************
Private Sub Form_KeyPress(KeyAscii As Integer) '按下ESC键退出
If KeyAscii = vbKeyEscape Then Unload Me
End Sub
'***********************************************************************
'上下左右8个方向调整窗体大小
Private Sub uppe_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture '上边
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTTOP, 0
End Sub
Private Sub down_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture '下边
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOM, 0
End Sub
Private Sub leftpic_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTLEFT, 0 '左边
End Sub
Private Sub right_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTRIGHT, 0& '右边
End Sub
Private Sub leftup_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTTOPLEFT, 0 '左上角
End Sub
Private Sub leftdown_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOMLEFT, 0 '左下角
End Sub
Private Sub rightup_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTTOPRIGHT, 0 '右上角
End Sub
Private Sub rightdown_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, 0 '右下角
End Sub
'***********************************************************************