i have a panel in vb and a form (FormBorderStyle.None). How can I resize the form? The Form must be FormBorderStyle.None!

Public Class Form1
    Private MouseIsDown As Boolean

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        'If the mouse is located at the bottom right corner then
        'set the mouseIsDown value to true
        If e.X > Me.Width - 6 AndAlso e.Y > Me.Height - 6 Then MouseIsDown = True
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

        If MouseIsDown Then
            'The mouse is down.  Make the form size to the location of the mouse
            Me.Width = e.X
            Me.Height = e.Y
        Else
            'The mouse is not down.  If the cursor is located at the bottom right
            'corner then change the cursor to the resize cursor
            If e.X > Me.Width - 6 AndAlso e.Y > Me.Height - 6 Then
                Me.Cursor = Cursors.SizeNWSE
            Else
                Me.Cursor = Cursors.Arrow
            End If
        End If
      
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        'Reset the MouseIsDown value
        MouseIsDown = False
    End Sub
End Class
Comments
:)
Public Class Form1
    Private MouseIsDown As Boolean

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        'If the mouse is located at the bottom right corner then
        'set the mouseIsDown value to true
        If e.X > Me.Width - 6 AndAlso e.Y > Me.Height - 6 Then MouseIsDown = True
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

        If MouseIsDown Then
            'The mouse is down.  Make the form size to the location of the mouse
            Me.Width = e.X
            Me.Height = e.Y
        Else
            'The mouse is not down.  If the cursor is located at the bottom right
            'corner then change the cursor to the resize cursor
            If e.X > Me.Width - 6 AndAlso e.Y > Me.Height - 6 Then
                Me.Cursor = Cursors.SizeNWSE
            Else
                Me.Cursor = Cursors.Arrow
            End If
        End If
      
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        'Reset the MouseIsDown value
        MouseIsDown = False
    End Sub
End Class

AWESOME! perfect

This article has been dead for over six months. Start a new discussion instead.