<DllImport("user32.dll")> _ Private Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef lpRect As Rectangle) As IntPtr End Function
Imports System.Runtime.InteropServices
Dim MonRectangle as new Rectangle
Imports System.Runtime.InteropServices Public Class Form1 <DllImport("user32.dll")> _ Private Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef lpRect As Rectangle) As IntPtr End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim rect As New Rectangle GetWindowRect(Me.Handle, rect) MessageBox.Show(String.Format("x={0} y={1} w={2} h={3}", rect.Left, rect.Top, rect.Width, rect.Height)) End Sub End Class
MessageBox.Show(String.Format("x={0} y={1} w={2} h={3}", rect.Left, rect.Top, rect.Width - rect.Left, rect.Height - rect.Top))Retrancher left de la largeur et top de la hauteur
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question