Public Class Form1 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Me.ShowInTaskbar = False 'barre de tâche visible End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Me.Close() End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable Me.AutoSize = True Me.SizeGripStyle = Windows.Forms.SizeGripStyle.Show End Sub End Class
Public Class Form1 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim Width As String Dim Height As String Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width.ToString() Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height.ToString() Me.ShowInTaskbar = False 'barre de tâche visible Me.MinimumSize = New Size(CInt(CDbl(Width) - 10), (CInt(CDbl(Height) - 50) + SystemInformation.CaptionHeight)) 'taille adapter à ton écran Me.Location = New Point(0, 0) 'location du Form End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Me.Close() End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable Me.AutoSize = True Me.SizeGripStyle = Windows.Forms.SizeGripStyle.Show End Sub End Class
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Class Form1 Private Declare Function ReleaseCapture Lib "user32" () As Integer Private Const HTCAPTION As Integer = 2 Private Const WM_NCLBUTTONDOWN As Integer = &HA1S Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Integer) As Integer Private Sub Form1_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown If e.Button = Windows.Forms.MouseButtons.Left And Me.Cursor = Cursors.Default Then ReleaseCapture() SendMessage(Me.Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0) End If End Sub Private Sub Form1_MouseMove(sender As Object, e As MouseEventArgs) Handles Me.MouseMove 'Definir le champs du resize < If e.Location.X > (Me.Size.Width - 5) And e.Location.Y > (Me.Size.Height - 5) Then ' changement du cursor (souris) Cursor = Cursors.SizeNWSE ' Si je clic sur le bouton gauche If e.Button = Windows.Forms.MouseButtons.Left Then ' redimentionnement de la forme Me.ClientSize = New System.Drawing.Size(e.Location.X, e.Location.Y) End If Else 'Si non le cursor redeviens normal Cursor = Cursors.Default End If End Sub End Class