Click here to Skip to main content
11,797,355 members (79,653 online)
Click here to Skip to main content

Tagged as

Moveable non-standard shape form

, 19 Dec 2010 CPOL 7K 9
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 9:51
subeditorWalt Fair, Jr.10-Dec-10 9:51 
GeneralMhm. Pin
Vercas13-Dec-10 8:48
memberVercas13-Dec-10 8:48 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151002.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by tumbledDown2earth
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid