16,555
社区成员
发帖
与我相关
我的任务
分享
Public Class Form1
Dim a As Boolean = False
Dim w As Double
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If a = False Then
w = Me.Height
a = True
End If
Me.WindowState = FormWindowState.Normal
Me.Top = 0
Me.Height = w
End Sub
End Class
PUBLIC A AS BOOLEAN
PUBLIC W AS INTEGER
Private Const MOUSECLICK1 As UInteger = &H112
Private Const MAXBUTTON1 As UInteger = &HF030
''重载窗体的窗口函数WndProc截获两个消息
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If (m.Msg = MOUSECLICK1) Then
If (m.WParam = MAXBUTTON1) Then
Me.MaximizedBounds = New System.Drawing.Rectangle(Me.Left, 0, 638, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height)
Me.Refresh()
End If
End If
MyBase.WndProc(m)
End Sub
Private Const MOUSECLICK1 As UInteger = &H112
Private Const MAXBUTTON1 As UInteger = &HF030
''重载窗体的窗口函数WndProc截获两个消息
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If (m.Msg = MOUSECLICK1) Then
If (m.WParam = MAXBUTTON1) Then
Me.MaximizedBounds = New System.Drawing.Rectangle(Me.Left, 0, 638, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height)
End If
End If
MyBase.WndProc(m)
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If a = False Then
w = Me.Height
a = True
End If
Me.WindowState = FormWindowState.Normal
Me.Top = 0
Me.Height = w
End Sub