第2个回答 2010-12-17
为什么一定要保留窗体的边框样式呢?
如果不保留的话,可以这样做:点击拖动image是可以拖动窗体的
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const HTCAPTION = 2
Const WM_NCLBUTTONDOWN = &HA1
Private Sub Form_Load()
Image1.Stretch = False
Me.AutoRedraw = True
Me.BorderStyle = 0
Me.BackColor = vbBlack
Me.Height = Image1.Height
Me.Width = Image1.Width
Me.Picture = Image1.Picture
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ReleaseCapture
SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub本回答被提问者和网友采纳