Results 1 to 6 of 6

Thread: [RESOLVED][2008] Making my borderless form draggable.

  1. #1

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Resolved [RESOLVED][2008] Making my borderless form draggable.

    Hi guys i need help on how to make my borderless form draggable or shall we say the user can easily drag the form anywhere. Need your help guys..God Bless and have a nice day!
    Last edited by shyguyjeff; Aug 5th, 2008 at 04:16 AM.

  2. #2
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: [2008] Making my borderless form draggable.

    Take a look at this, i think this is what you want?!

    Mojo

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] Making my borderless form draggable.

    one question first before I try help you out - why does your signature say jmcilhinney but it links to someone else's profile (scootabug or someone) ?

    Anyway, with that out of the way I needed to do this not long ago so when I get home I'll dig out the code I used. A quick google search found this though, however I'm sure thats not the way I did it before.

    vb Code:
    1. Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    2.         Select Case m.Msg
    3.             Case WM_NCHITTEST
    4.                 MyBase.WndProc(m)
    5.                 If m.Result = HTCLIENT Then m.Result = HTCAPTION
    6.                 'If m.Result.ToInt32 = HTCLIENT Then m.Result = IntPtr.op_Explicit(HTCAPTION) 'Try this in VS.NET 2002/2003 if the latter line of code doesn't do it... thx to Suhas for the tip.
    7.             Case Else
    8.                 'Make sure you pass unhandled messages back to the default message handler.
    9.                 MyBase.WndProc(m)
    10.         End Select
    11.     End Sub
    You place this code at class level in your form (meaning it does not go in any existing Sub or Function) and then the whole form area should be 'draggable'. See if it does what you want.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] Making my borderless form draggable.

    Quote Originally Posted by mrmojorisin
    Take a look at this, i think this is what you want?!

    Mojo
    Ahh yeah thats the way I did it before!
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: [2008] Making my borderless form draggable.

    Thanks guys..it's working...God Bless and have a nice day everyone..

  6. #6
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: [RESOLVED][2008] Making my borderless form draggable.

    Glad to help and i think you should keep your link that way its funny!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width