How to resize from a form to the left?

Asked

Viewed 52 times

1

I was needing to change the size of one Form no edges with the mouse, I looked for some ways to do this, but all of them when the mouse left the Form the resize stop. So I decided to do it this way:

Private Sub Panel3_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel3.MouseDown
    mbot = True
End Sub

Private Sub Panel3_MouseUp(sender As Object, e As MouseEventArgs) Handles Panel3.MouseUp
    mbot = False
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

    If mbot Then                 
        Height += MousePosition.Y - Height - Top        
    End If

End Sub

This worked right, both right, low and vertex(right / low), but I could not do up and left. I’ve tried it many ways and the one that worked out the most was this:

  Dim pos = Width
    Dim loc = Left

    If mleft Then

        DesktopLocation = New Point(MousePosition.X, DesktopLocation.Y)
        Width = pos + loc - Left

    End If

I did what the Form change location by following the cursor and the difference of the previous position and the new one is added to the Width. Her problem is that when the Form is moved, the right side is blinking. So what I wanted to know is how can I "raise" the Form to the left without this problem.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.