How to block double click in overridden WndProc function in Windows Forms?
c#, winapi, winforms
Solution
In addition to JaredPar I would suggest don not create draggable form in that way, but handle it in 3 steps
- identify mouse down on the form
- capture mouse
- identify mouse up event
It is not a complicated to handle, and it's better, imo, then disabling a double click on the form.
For complete example of how you can do that can have a look on
Creating a Draggable Borderless Form
Problem
I have a form created in Windows Forms which is draggable wherever I click. I made it by overriding WndProc function which in turn modifies each click as it was a title bar click: ``` //found at: http://stackoverflow.com/questions/3995009/how-to-make-a-window-draggablec-winforms private const int WM_NCHITTEST = 0x84; private const int HTCLIENT = 0x1; private const int HTCAPTION = 0x2; /// /// Handling the window messages /// protected override void WndProc(ref Message message) { base.WndProc(ref message); if (message.Msg == WM_NCHITTEST && (int)message.Result == HTCLIENT) message.Result = (IntPtr)HTCAPTION; } ``` The problem is that now when I double click, the window becomes fullscreen, which is unwanted. How can I block this behavior?