Windows Develop Bookmark and Share   
 index > Windows Forms General > mouse events from a non-client area of a control
 

mouse events from a non-client area of a control

Is there a way toget mouse events from a non-client area of a control?

I tried to override the WndProc of the control but it doesnt seem to get any WM_NCMOUSEMOVE Messages.

Ialso seek a way to change the mouse cursor when its on the non-client area, even if i change the cursor property of the control the cursor still becomes an arrow when the mouse is over the non-client area

thanks in advance

EvilProject  Saturday, April 05, 2008 5:26 PM

To have mouse messages over the non-client area, you should first have a non-client area. To get that, handle: WM_NCCALCSIZE to notify windows about the non-client-area. After that, you should deal with WM_NCHITTEST and return a non-client area value, like HTTOPLEFT or HTCAPTION to notify windows that the mouse is currently NOT on the Client Area.

Then you will receive WM_NCMOUSEMOVE messages.

For details on those messages:

WM_NCCALCSIZE

http://msdn2.microsoft.com/en-us/library/ms632634(VS.85).aspx

WM_NCHITTEST

http://msdn2.microsoft.com/en-us/library/ms645618(VS.85).aspx

www.qiosdevsuite.com  Sunday, April 06, 2008 12:06 AM

To have mouse messages over the non-client area, you should first have a non-client area. To get that, handle: WM_NCCALCSIZE to notify windows about the non-client-area. After that, you should deal with WM_NCHITTEST and return a non-client area value, like HTTOPLEFT or HTCAPTION to notify windows that the mouse is currently NOT on the Client Area.

Then you will receive WM_NCMOUSEMOVE messages.

For details on those messages:

WM_NCCALCSIZE

http://msdn2.microsoft.com/en-us/library/ms632634(VS.85).aspx

WM_NCHITTEST

http://msdn2.microsoft.com/en-us/library/ms645618(VS.85).aspx

www.qiosdevsuite.com  Sunday, April 06, 2008 12:06 AM

You can use google to search for other answers

Custom Search

More Threads

• listview item question
• How to automatically show the SHORTCUT to a textbox?
• DataGrid Control header text trims on right alignment
• VB.NET and VB interop
• how to limit number of instances of a form being opened?
• Async Call to multiple function & should return to common method
• Pass around object references or IDs?
• how to Find a find somewhere in harddiver?
• extendeding the TextBox control
• Controlling Windows Application From Web