I require some help.
I want to resize my form from the Corner (Right corner) in the boderless form.
I know the coding as for resize it with the four different direction but unknown with the Corners.

Codes I used to resize the Form from four different direction (up,down,right,left):

Private Sub UpR_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles UpR.MouseMove 
If e.Button = Windows.Forms.MouseButtons.Left Then 
    Me.Size = New Size(Me.Size.Width, Me.Size.Height + (Me.Location.Y - MousePosition.Y)) 
    Me.Location = New Point(Me.Location.X, MousePosition.Y) 
End If 
End Sub 

Private Sub DownR_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DownR.MouseMove 
If e.Button = Windows.Forms.MouseButtons.Left Then 
    Me.Size = New Size(Me.Size.Width, MousePosition.Y - Me.Location.Y) 
End If 
End Sub 

Private Sub LeftR_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LeftR.MouseMove 
If e.Button = Windows.Forms.MouseButtons.Left Then 
    Me.Size = New Size(Me.Size.Width + (Me.Location.X - MousePosition.X), Me.Size.Height) 
    Me.Location = New Point(MousePosition.X, Me.Location.Y) 
End If 
End Sub 

Private Sub RightR_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RightR.MouseMove 
If e.Button = Windows.Forms.MouseButtons.Left Then 
    Me.Size = New Size(MousePosition.X - Me.Location.X, Me.Size.Height) 
End If 
End Sub 

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize 
    DownR.Location = New Point(0, Me.Size.Height - 2) 
    RightR.Location = New Point(Me.Size.Width - 2, 0) 
    UpR.Size = New Size(Me.Size.Width, 2) 
    DownR.Size = New Size(Me.Size.Width, 2) 
    LeftR.Size = New Size(2, Me.Size.Height) 
    RightR.Size = New Size(2, Me.Size.Height) 
End Sub

IS THERE SOMTHING THAT I HAVE TO DO?
I USED PICTURE BOX. for this....

PLEASE HELP ME WITH THE CORNER.

when the mouse is dragged from the corner read the movement along both the x and y axis and adjust the resize on both x and y axis. Something like this:

Dim XOffset, YOffset as Integer
XOffset = MousePosition.X - Me.Location.X
YOffset = MousePosition.Y - Me.Location.Y
Me.Size = New Size(Me.Location.X + XOffset, Me.Location.Y + YOffset)

This adjust on both axis in either direction

@tinstaafl:
hmm nt working:

Please Check this Project file

@tinstaafl:

full project file is here:

Got it. The trick is to use Size instead of Location and the Mouse.Move event of the form:

Private Sub Form1_MouseMove(sender As Object, e As MouseEventArgs) Handles MyBase.MouseMove
    If e.Button = Windows.Forms.MouseButtons.Left AndAlso e.X >= (Me.Size.Width - 20) AndAlso e.Y >= (Me.Size.Height - 20) Then
        Dim XOffset, YOffset As Integer
        XOffset = e.X - (Me.Size.Width)
        YOffset = e.Y - (Me.Size.Height)
        Me.Size = New Size(Me.Size.Width + XOffset, Me.Size.Height + YOffset)
    End If
End Sub

This will allow the mouse to resize the form on either or both axis. I set the area to catch the mouse to resize to be 20 pixels, but than can easily be changed.

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.