How to Move a Borderless and Transparent Form?
2014-06-05, 04:05 PM,
#1
Hello I just want to learn how to drag/move the borderless or transparent form. I already watch some tutorials on Youtube but it doesn't fit what I want.. What I want is, when you hold any part of the VB app you can move it..

Example of this one is the app given here:HQ Apps

How much you can take and keep moving forward.
That's how winning is done!

Reply
2014-06-05, 05:13 PM,
#2
You mean something like this?

Code:
Public Class Form1
    'Declare the variables
    Dim drag As Boolean
    Dim mousex As Integer
    Dim mousey As Integer

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        drag = True 'Sets the variable drag to true.
        mousex = Windows.Forms.Cursor.Position.X - Me.Left 'Sets variable mousex
        mousey = Windows.Forms.Cursor.Position.Y - Me.Top 'Sets variable mousey
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        'If drag is set to true then move the form accordingly.
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mousey
            Me.Left = Windows.Forms.Cursor.Position.X - mousex
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        drag = False 'Sets drag to false, so the form does not move according to the code in MouseMove
    End Sub
End Class
Latest Thanks - View all

tbpi007(2014-07-07 07:34 PM) dahilan01(2014-06-05 06:56 PM) 
Reply
2014-06-05, 06:52 PM,
(This post was last modified: 2014-06-05, 06:56 PM by dahilan01.)
#3
(2014-06-05, 05:13 PM)TheInsidiousX Wrote: You mean something like this?

Code:
Public Class Form1
    'Declare the variables
    Dim drag As Boolean
    Dim mousex As Integer
    Dim mousey As Integer

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        drag = True 'Sets the variable drag to true.
        mousex = Windows.Forms.Cursor.Position.X - Me.Left 'Sets variable mousex
        mousey = Windows.Forms.Cursor.Position.Y - Me.Top 'Sets variable mousey
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        'If drag is set to true then move the form accordingly.
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mousey
            Me.Left = Windows.Forms.Cursor.Position.X - mousex
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        drag = False 'Sets drag to false, so the form does not move according to the code in MouseMove
    End Sub
End Class

Hello sir, I put the code on my Form I also add panel is it required? and debug but I can't move/drag the form.


Thank you so much sir. I got it worked :) thanks

How much you can take and keep moving forward.
That's how winning is done!

Reply
2014-06-26, 05:55 AM,
#4
(2014-06-05, 06:52 PM)dahilan01 Wrote:
(2014-06-05, 05:13 PM)TheInsidiousX Wrote: You mean something like this?

Code:
Public Class Form1
    'Declare the variables
    Dim drag As Boolean
    Dim mousex As Integer
    Dim mousey As Integer

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        drag = True 'Sets the variable drag to true.
        mousex = Windows.Forms.Cursor.Position.X - Me.Left 'Sets variable mousex
        mousey = Windows.Forms.Cursor.Position.Y - Me.Top 'Sets variable mousey
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        'If drag is set to true then move the form accordingly.
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mousey
            Me.Left = Windows.Forms.Cursor.Position.X - mousex
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        drag = False 'Sets drag to false, so the form does not move according to the code in MouseMove
    End Sub
End Class

Hello sir, I put the code on my Form I also add panel is it required? and debug but I can't move/drag the form.


Thank you so much sir. I got it worked :) thanks
Glad someone helped you :) This is such a helpful forum.
Reply
2014-07-06, 04:19 PM,
#5
(2014-06-05, 05:13 PM)TheInsidiousX Wrote: You mean something like this?

Code:
Public Class Form1
    'Declare the variables
    Dim drag As Boolean
    Dim mousex As Integer
    Dim mousey As Integer

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        drag = True 'Sets the variable drag to true.
        mousex = Windows.Forms.Cursor.Position.X - Me.Left 'Sets variable mousex
        mousey = Windows.Forms.Cursor.Position.Y - Me.Top 'Sets variable mousey
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        'If drag is set to true then move the form accordingly.
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mousey
            Me.Left = Windows.Forms.Cursor.Position.X - mousex
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        drag = False 'Sets drag to false, so the form does not move according to the code in MouseMove
    End Sub
End Class
I still need help abt it. putted the code to my form and what now? thanks
Reply
2014-07-06, 04:20 PM,
(This post was last modified: 2014-07-06, 05:15 PM by kelenter.)
#6
I still need help abt it. i put the code to form and what now? thanks

got it. ))) but i have another problem. how to make it looks transparent? like abowe shown HQ app???

done! )))) thy very much!
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  VB NET FORM APPLICATION QwertySon 12 1,740 2016-04-27, 08:00 PM
Last Post: Harrington
  form in wordpress site Big Chief 6 520 2015-02-25, 03:06 PM
Last Post: regzastyle
  move wp site to main site Big Chief 2 305 2015-02-13, 02:03 AM
Last Post: lordeahava
  How to make png image edges smooth on transparent form VB thepublisher 2 518 2014-06-14, 04:37 AM
Last Post: thepublisher
  Help with a form dox 7 849 2013-12-02, 12:58 PM
Last Post: Removed




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top