Results 1 to 11 of 11
  1. #1
    calvin839's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Rocking on your bed :P
    Posts
    110
    Reputation
    9
    Thanks
    0
    My Mood
    Sleepy

    Question Help Moving Borderless Window



    How do I make the tool draggable?Like a normal tool window?



    Virus Scans:
    VirusTotal Scan

    Jotti's Malware Scan

    MetaScan Scan Results

    Last edited by calvin839; 06-16-2012 at 05:59 AM. Reason: Show Image for Approval


    [=-My Steam Shop=-] V

  2. #2
    Pingo's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    687
    Reputation
    24
    Thanks
    865
    My Mood
    Blah
    You mean move the controls around on the form after runtime?

  3. #3
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,123
    My Mood
    Angelic
    You have to provide a image of it in order for it to be approved.

    From what I see, you want to know how to move the form when you uses like none on the formstyle.

    Something I found on the net:
    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

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  4. The Following User Says Thank You to Jorndel For This Useful Post:

    calvin839 (06-16-2012)

  5. #4
    Pingo's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    687
    Reputation
    24
    Thanks
    865
    My Mood
    Blah
    @Jorndel
    A far cleaner and better solution would be to use the form mouse down event and WndProc.
    Code:
        Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
            Capture = False
            WndProc(Message.Create(Handle, &HA1, New IntPtr(2), IntPtr.Zero))
        End Sub
    Thats all the code needed to move a borderless form.
    The other method works just fine aswell but alot more messing about.
    I'v used both methods in the past, depends on my situation.

  6. The Following User Says Thank You to Pingo For This Useful Post:

    calvin839 (06-16-2012)

  7. #5
    calvin839's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Rocking on your bed :P
    Posts
    110
    Reputation
    9
    Thanks
    0
    My Mood
    Sleepy
    Thanks for the replies.

    But would the code you've mentioned help me drag the window since I used none as a form design.


    [=-My Steam Shop=-] V

  8. #6
    Pingo's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    687
    Reputation
    24
    Thanks
    865
    My Mood
    Blah
    Yes both codes will let you drag it. And if you wish to resize the form aswell, this will do it
    Code:
        Protected Overrides Sub WndProc(ByRef Msg As Message)
            If (Msg.Msg = &H84) Then
                Dim _Point As Point = PointToClient(New Point(CInt(Msg.LParam.ToInt64 + &HFFFF), CInt((Msg.LParam.ToInt64 + &HFFFF0000) >> &H10)))
                Dim _Size As Size = ClientSize
                If (_Point.X >= _Size.Width - &H10 AndAlso _Point.Y >= _Size.Height - &H10 AndAlso _Size.Height >= &H10) Then
                    Msg.Result = If(IsMirrored, New IntPtr(&H10), New IntPtr(&H11))
                    Return
                End If
            End If
            MyBase.WndProc(Msg)
        End Sub
    Dragging the bottom right corner of the form allows you to resize.

  9. The Following User Says Thank You to Pingo For This Useful Post:

    calvin839 (06-16-2012)

  10. #7
    calvin839's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Rocking on your bed :P
    Posts
    110
    Reputation
    9
    Thanks
    0
    My Mood
    Sleepy
    Thanks Pingo!It works nicely.

    ---------- Post added at 09:07 PM ---------- Previous post was at 08:58 PM ----------

    Btw,do you guys happen to know how to map a function to a certain keyboard key?Like mapping "ENTER" with the equal sign for the above. o-o[COLOR="Silver"]


    [=-My Steam Shop=-] V

  11. #8
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,123
    My Mood
    Angelic
    Quote Originally Posted by calvin839 View Post
    Thanks Pingo!It works nicely.

    ---------- Post added at 09:07 PM ---------- Previous post was at 08:58 PM ----------

    Btw,do you guys happen to know how to map a function to a certain keyboard key?Like mapping "ENTER" with the equal sign for the above. o-o[COLOR="Silver"]
    Try to add an keydown event for the button?
    And do a check. e.KeyData = Keys.Enter

    And on the form set this to True: Key Preview

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  12. The Following User Says Thank You to Jorndel For This Useful Post:

    calvin839 (06-16-2012)

  13. #9
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,679
    My Mood
    Mellow
    Hey dumbfucks, draw on a Form control. Set the FormBorderStyle to "None". Winner winner chicken dinner.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  14. #10
    DawgiiStylz's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Dawg House
    Posts
    7,809
    Reputation
    219
    Thanks
    2,902
    My Mood
    Tired
    Try this code:

    This lets you Maximize the window as well.

    Code:
    #Region "Move Form"
        Const WM_NCHITTEST As Integer = &H84
        Const HTCLIENT As Integer = &H1
        Const HTCAPTION As Integer = &H2
        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            Select Case m.Msg
                Case WM_NCHITTEST
                    MyBase.WndProc(m)
                    If m.Result = HTCLIENT Then m.Result = HTCAPTION
                Case Else
                    MyBase.WndProc(m)
            End Select
        End Sub
    #End Region

  15. #11
    .:.Apple?!.:.'s Avatar
    Join Date
    Jan 2012
    Gender
    male
    Location
    In a House?!
    Posts
    7
    Reputation
    10
    Thanks
    0
    Code:
    Public Class Form1
        Private MausLocation As Point
    
        Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
            If e.Button = Windows.Forms.MouseButtons.Left Then
                MausLocation = e.Location
            End If
        End Sub
    
        Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
            If e.Button = Windows.Forms.MouseButtons.Left Then
                Me.Location = e.Location - MausLocation + Me.Location
            End If
        End Sub
    End Class
    I think that works

Similar Threads

  1. [Help]Moving things around`
    By Samueldo in forum Visual Basic Programming
    Replies: 7
    Last Post: 01-07-2010, 03:31 PM
  2. [Help]About.vb Windows Form
    By LetItRock in forum Visual Basic Programming
    Replies: 12
    Last Post: 11-12-2009, 08:36 AM
  3. Help, Check If windows is shutting down!
    By Zoom in forum Visual Basic Programming
    Replies: 6
    Last Post: 11-07-2009, 06:15 AM
  4. [Help] Combat arms Window
    By shawnyboi15 in forum Combat Arms Help
    Replies: 7
    Last Post: 10-19-2009, 11:33 AM
  5. Help with Teamspeak windowed mode
    By CyborgDeamon in forum Combat Arms Hacks & Cheats
    Replies: 5
    Last Post: 04-01-2009, 05:00 PM

Tags for this Thread