public override bool MouseDown(Control c, Point pt, MouseButtons button)
{
// Let base class process the mouse down
bool ret = base.MouseDown(c, pt, button);
// If a change in capturing state has occured
if (ret != _moving)
{
// If we are now capturing input
if (ret)
{
// Remember the starting mouse position
_downPosition = pt;
// Remember new capture state
_moving = true;
// Cache information from the separator
_separatorBox = _source.SeparatorMoveBox;
_separatorIncrements = _source.SeparatorIncrements;
_separatorOrientation = _source.SeparatorOrientation;
// Make sure any paint requested by base class has been performed
_source.SeparatorControl.Update();
// Draw the initial movement indicator
Point splitPt = RecalcClient(pt);
DrawSeparatorStarting(splitPt);
// Register a message filter to intercept the escape key
RegisterFilter();
}
else
{
// We must have lost capture
_moving = false;
// Remove the message filter, as long as it is registered
// it will prevent the class from being garbage collected.
UnregisterFilter();
// Callback to the source to show movement has finished
Point splitPt = RecalcClient(pt);
_source.SeparatorMoved(pt, splitPt);
}
}
return ret;
}