private Point GetPointAsParent(Control ctrl,Control parentCtrl)
{
int x, y;
x=ctrl.Location.X;
y=ctrl.Location.Y;
while (ctrl.Parent!=null && !ctrl.Parent.GetType().Equals(parentCtrl.GetType()))
{
x += ctrl.Parent.Location.X;
y += ctrl.Parent.Location.Y;
ctrl = ctrl.Parent;
}
return new Point(x, y);
}
{
int x, y;
x=ctrl.Location.X;
y=ctrl.Location.Y;
while (ctrl.Parent!=null && !ctrl.Parent.GetType().Equals(parentCtrl.GetType()))
{
x += ctrl.Parent.Location.X;
y += ctrl.Parent.Location.Y;
ctrl = ctrl.Parent;
}
return new Point(x, y);
}