Copyright Codenstuff.com 2017
YOU NEED TO BE LOGGED IN TO USE THIS FEATURE


Register
Credits
0
Reputation
0

----

----
NEWS
Windows 10 Game Mode
Microsoft will shortly release a Windows 10 update called 'Creators Update' which will include a great feature gamers will love. Game Mode.
Read more..
REVIEW
Construct 2
Easy to use and learn software for creating all manor of HTML5 games for mobile, web and desktop.
Read more..
SHOUT
Happy Holidays
As we approached the end of the year and head of to celebrate the holidays with friends and family I just want to wish you happy holidays.
Read more..
NEWS
Hey Cortana
Microsoft's personal assistant is finally available for Android and iOS in the UK and gets a fresh new look.
Read more..
NEWS
New Visual Studio Toys
At this years Microsoft Connect(); event they announced a whole bunch of new development software, including Visual Studio 2017
Read more..

----

----

----
User avatar Move Form With Mouse Drag
smashapps Sat Dec 12, 2015 4:47 am
Hey All,

I have re made the tutorial Move Form With Mouse Drag, so that it works in Visual Studio 2015.

https://www.youtube.com/watch?v=Q8N9LYqNzIc

Code: Select all
Public Class frmMain
 
    Public BeingDragged As Boolean = False
    Public MouseDownX As Integer
    Public MouseDownY As Integer
 
    Private Sub frmMain_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
        If e.Button = MouseButtons.Left Then
            BeingDragged = True
            MouseDownX = e.X
            MouseDownY = e.Y
        End If
    End Sub
 
    Private Sub frmMain_MouseMove(sender As Object, e As MouseEventArgs) Handles Me.MouseMove
        If BeingDragged = True Then
            Dim tmp As Point = New Point()
 
            tmp.X = Me.Location.X + (e.X - MouseDownX)
            tmp.Y = Me.Location.Y + (e.Y - MouseDownY)
            Me.Location = tmp
            tmp = Nothing
        End If
    End Sub
 
    Private Sub frmMain_MouseUp(sender As Object, e As MouseEventArgs) Handles Me.MouseUp
        If e.Button = MouseButtons.Left Then
            BeingDragged = False
        End If
    End Sub
 
End Class


This can easily be modified to use on controls within the form, so you can move around controls at run time by moving the mouse.

If you want any help feel free to ask.

Please +rep if you liked the tutorial.

----


cron