怎么限制MDIForm1窗体大小不能拖拉?在线等
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
'上面是去掉最大化按钮的声明
Private le As Long, tp As Long, wi As Long, he As Long '限制窗体移动声明
Private Sub MDIForm_Load()
Me.Move 0, 0, Screen.Width, Screen.Height '窗体最大化
' Me.WindowState = 2 '窗体全屏,把窗体的BorderStyle = 0,窗体的windowstate属性为2
'==========================
'le = Me.Left
'tp = Me.Top
wi = Me.Width
he = Me.Height
'============================
'去掉最大化按钮
Dim lStyle As Long
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
lStyle = lStyle And Not WS_MAXIMIZEBOX
SetWindowLong Me.hwnd, GWL_STYLE, lStyle
'==================
End Sub
Private Sub MDIForm_Resize()
'Me.Left = le
'Me.Top = tp
Me.Width = wi
Me.Height = he
End Sub
程序运行的时候
Me.Move 0, 0, Screen.Width, Screen.Height '窗体最大化触发了Private Sub MDIForm_Resize()过程,我是想先把窗体最大化然后限制窗体不能拖动大小!求教