Hello All,
I've got a custom control ( Panel-like, but not inheriting from Panel)
that
has a header region that's custom drawn.
Custom Control is using a custom controldesigner class that inherits
from
ParentControlDesigner.
Just for starters I wanted to try to change the mouse cursor if it fell
within the area of my header rectangle. So far I've not been able to
achieve this. The overall goal is to keep controls from being dropped
onto
my custom control's header area. I've not done any work with the drag
and
drop logic as of yet. Just wanted to try to make the mouse cursor
change to
see if I was on the right track.
I've done some testing by overriding WndProc and listening for
WM_MouseMove,
but to no avail.
Ex.
protected override void WndProc(ref Message m)
{
CollapsiblePanel cp = (CollapsiblePanel)this.Control;
switch (m.Msg)
{
case WM_MOUSEMOVE:
POINTAPI pnta = new POINTAPI();
GetCursorPos(ref pnta);
Point pt = this.Control.PointToClient(new Point(pnta.x, pnta.y));
if ((pt.X >= cp.Header.X && pt.X <= cp.Header.Width) && (pt.Y >=
cp.Header.Y
&& pt.Y <= cp.Header.Height))
{
this.Control.Parent.Text = "Bingo"
this.Control.Cursor = Cursors.No;
}
else
{
this.Control.Cursor = Cursors.Default;
}
break;
}
base.WndProc(ref m);
}
In testing I do get "Bingo" in the parent form text, but the cursor
doesnt
change.
What am I doing wrong here?
Thanks,
Andy
|