请问怎么移动无标题的窗体,因控件多以至用不了Form的有关事件
RT,因为控件多了点,所以Form_MouseDown等事件都没办法用上了,请问这时候怎么移动无标题的窗体?先谢谢了!
Option Explicit 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 Private Const WM_NCLBUTTONDOWN As Long = &HA1 Private Const HTCAPTION As Long = 2 Private Sub Command1_Click(Index As Integer) Debug.Print "Command1_Click", Index End Sub Private Sub Form_Load() Dim w&, h&, i&, j&, n& w = Me.ScaleWidth \ Command1(0).Width h = Me.ScaleHeight \ Command1(0).Height n = w * h Command1(0).Caption = "0" For i = 1 To n - 1 Load Command1(Command1.UBound + 1) Command1(Command1.UBound).Left = Command1(Command1.UBound - 1).Left + Command1(Command1.UBound - 1).Width Command1(Command1.UBound).Top = Command1(Command1.UBound - 1).Top If i Mod w = 0 Then Command1(Command1.UBound).Left = Command1(Command1.UBound - w).Left Command1(Command1.UBound).Top = Command1(Command1.UBound - 1).Top + Command1(Command1.UBound - 1).Height End If Command1(Command1.UBound).Caption = i Command1(Command1.UBound).Visible = True Next End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Call ReleaseCapture Call SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&) End If End Sub Private Sub Command1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) Form_MouseMove Button, Shift, X, Y End Sub自己测试吧,添加一个按钮数组。话说,你是用别的移动窗口的方法吧?