I’m looking for a way to develop this:

(source: hostingpics.net)
When the mouse is over the form’s title bar (rectange 1 on the picture) the form content (the rectangle 2) is visible & when the mouse is not over, it disappears but the rectangle 1 must remain visible!
How could i manage to do that ?
Thanks in advance
There are some mouse events related to the non-client area of the forms (
WM_NCMOUSEMOVE,WM_NCMOUSELEAVE, …) that can be used for this purpose. But this is not simple, because they are not included in Windows Forms. To use this events, you should overrideWndProcof your form. CatchingWM_NCMOUSEMOVEevent is somehow simple, butWM_NCMOSUELEAVEis a little tricky. Windows normally does not send mouse leave events to windows, unless they request it explicitly usingTrackMouseEventfunction.Here is the complete code that does exactly what you want:
Put this code section in your form class, and that takes care of everything.
By overriding
WndProcwe are handling required mouse events. InWM_NCMOUSEMOVEevent, we call a method to inform the operating system that we are interested inWM_NCMOUSELEAVEevent, and also we show the client area of the form (if not visible).In
WM_NCMOUSELEAVEevent we hide the client area of the form (if the cursor is not on the form). Every time theWM_NCMOUSELEAVEevent is called, all tracking events requested byTrackMouseEventare canceled, so we must call theTrackMouseEventfunction every time inWM_NCMOUSEMOVE.Be aware that maximizing the form is not considered in this code and you should handle it somehow.