is that possible?

Recommended Answers

All 4 Replies

I didn't get what you said. Can you explain a little more?

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

Member Avatar for Unhnd_Exception
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
commented: :) +1
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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.