Today i wanted to check whether user click in with in the context of the panel. Since panel doesnt provide hittest this is how to do it ..
private bool panel_hit_test(Panel panel, POINT point_test)
{
Rectangle rect = panel.RectangleToScreen(panel.ClientRectangle);
if ((point_test.x > rect.X && point_test.x < rect.X + rect.Width) &&
(point_test.y > rect.Y && point_test.y < rect.Y + rect.Height))
{
return true;
}
else
return false;
}
Thursday, May 28, 2009
Subscribe to:
Post Comments (Atom)
2 comments:
Thanks for posting this, you saved my a$$.
The Windows Forms Panels and Labels Controls are a set of container controls that can be used to build extendable and themable controls with attractive user interface design for your Windows Forms applications.
Post a Comment