Click here to Skip to main content
12,758,300 members (35,037 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


9 bookmarked
Posted 9 Dec 2010

Moveable non-standard shape form

, 19 Dec 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Trick for dragging the form while clicking on the client area
This is a trick for dragging the form while clicking on the client area (assuming that the header of the form is removed).

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
public static extern bool ReleaseCapture();
private void Form1_MouseDown(object sender, MouseEventArgs e)
    if (e.Button == MouseButtons.Left)
         SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
India India
is a poor software developer and thinker. Presently working on a theory of "complementary perception". It's a work in progress.

You may also be interested in...

Comments and Discussions

GeneralIf you do that, how do you allow clicking on the form withou... Pin
Walt Fair, Jr.10-Dec-10 10:51
subeditorWalt Fair, Jr.10-Dec-10 10:51 
GeneralMhm. Pin
Vercas13-Dec-10 9:48
memberVercas13-Dec-10 9:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170217.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by tumbledDown2earth
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid