Click and Drag Anywhere

Post your questions regarding programming in Visual Basic 6 in here.
1 post Page 1 of 1
Contributors
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Click and Drag Anywhere
mikethedj4
ok well I'm new to Visual basic 6, however I'm not using VB 6. I'm actually using a program that's similar to VB 6 called Jabaco. Anyway I created a custom GUI, and I already got the rollovers, minimize, maximize, etc: however I wanna be able to click anywhere on the program, and drag it anywhere on my desktop.

I know in VB 2008 I can use
Code: Select all
#Region " Global Variables "
    Dim Point As New System.Drawing.Point()
    Dim X, Y As Integer
#End Region

#Region " GUI "
    Private Sub Main_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
        If e.Button = MouseButtons.Left Then
            Point = Control.MousePosition
            Point.X = Point.X - (X)
            Point.Y = Point.Y - (Y)
            Me.Location = Point
        End If
    End Sub
    Private Sub Main_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
        X = Control.MousePosition.X - Me.Location.X
        Y = Control.MousePosition.Y - Me.Location.Y
    End Sub
#End Region
However I have no idea how I can do this using a vb6 code for jabaco. SO if anyone can help me out this will be great.
1 post Page 1 of 1
Return to “General coding help”