Mobile ResizeForm
Private realSize As Size
_
Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Repaint As Boolean) As IntPtr
End Function
_
Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nItem As Integer) As Integer
End Function
_
Public Shared Sub SetWindowLong(ByVal hWnd As IntPtr, ByVal nItem As Integer, ByVal nValue As Integer)
End Sub
_
Public Shared Function GetCapture() As IntPtr
End Function
Public Const GWL_STYLE As Integer = -16
Public Const WS_CAPTION As Integer = &HC00000
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
realSize = New Size(224, 144)
ResizeForm()
End Sub
Private Sub ResizeForm()
Dim x, y As Integer
x = (Screen.PrimaryScreen.WorkingArea.Width - realSize.Width) / 2
y = (Screen.PrimaryScreen.WorkingArea.Height - realSize.Height) / 2 + Screen.PrimaryScreen.WorkingArea.Top
Me.Capture = True
Dim hWnd As IntPtr = GetCapture()
Me.Capture = False
SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) Or WS_CAPTION)
MoveWindow(hWnd, x, y, realSize.Width, realSize.Height, True)
End Sub
Public Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Repaint As Boolean) As IntPtr
End Function
Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nItem As Integer) As Integer
End Function
Public Shared Sub SetWindowLong(ByVal hWnd As IntPtr, ByVal nItem As Integer, ByVal nValue As Integer)
End Sub
Public Shared Function GetCapture() As IntPtr
End Function
Public Const GWL_STYLE As Integer = -16
Public Const WS_CAPTION As Integer = &HC00000
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
realSize = New Size(224, 144)
ResizeForm()
End Sub
Private Sub ResizeForm()
Dim x, y As Integer
x = (Screen.PrimaryScreen.WorkingArea.Width - realSize.Width) / 2
y = (Screen.PrimaryScreen.WorkingArea.Height - realSize.Height) / 2 + Screen.PrimaryScreen.WorkingArea.Top
Me.Capture = True
Dim hWnd As IntPtr = GetCapture()
Me.Capture = False
SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) Or WS_CAPTION)
MoveWindow(hWnd, x, y, realSize.Width, realSize.Height, True)
End Sub
留言