C
Chris Dunaway
I have a form in which I have set the border style to None so that there is
no caption, no close box, etc.
I use this code to be able to click the form and move in the absense of the
caption:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Const WmNcHitTest As Integer = &H84
Const HtCaption As Integer = 2
If m.Msg = WmNcHitTest Then
m.Result = New IntPtr(HtCaption)
Else
MyBase.WndProc(m) 'THIS IS IMPORTANT!
End If
End Sub
And this works well. My problem comes when I placed a panel on the form
and set it's Dock property to Fill. Now when I click on the form, I am
actually clicking on the panel and so the NCHitTest message is not getting
sent to the form. In fact, I am using a custom panel inherited from the
regular panel in which I am doing all the painting. If override the
WndProc method of the panel, then clicking on the panel MOVES THE PANEL
around the form but does not move the form.
I need to somehow have the form interrupt the message first and process it
if it is an NCHitTest message.
Can anyone provide me with any guidance?
Thanks,
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
no caption, no close box, etc.
I use this code to be able to click the form and move in the absense of the
caption:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Const WmNcHitTest As Integer = &H84
Const HtCaption As Integer = 2
If m.Msg = WmNcHitTest Then
m.Result = New IntPtr(HtCaption)
Else
MyBase.WndProc(m) 'THIS IS IMPORTANT!
End If
End Sub
And this works well. My problem comes when I placed a panel on the form
and set it's Dock property to Fill. Now when I click on the form, I am
actually clicking on the panel and so the NCHitTest message is not getting
sent to the form. In fact, I am using a custom panel inherited from the
regular panel in which I am doing all the painting. If override the
WndProc method of the panel, then clicking on the panel MOVES THE PANEL
around the form but does not move the form.
I need to somehow have the form interrupt the message first and process it
if it is an NCHitTest message.
Can anyone provide me with any guidance?
Thanks,
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.