public virtual void MouseUp(Control c, Point pt, MouseButtons button)
{
// If the mouse is currently captured
if (_captured)
{
// Not capturing mouse input anymore
_captured = false;
// Only interested in left mouse being released
if (button == MouseButtons.Left)
{
// Only if the button is still pressed, do we generate a click
if (_target.ElementState == PaletteState.Pressed)
{
// Move back to hot tracking state, we have to do this
// before the click is generated because the click processing
// might change focus and so cause the MouseLeave to be
// called and change the state. If this was after the click
// then it would overwrite and lose that leave state change.
_target.ElementState = PaletteState.Tracking;
}
// Stop the repeat clicks
_repeatTimer.Stop();
// Repaint to reflect new state
PerformNeedPaint(false);
}
else
{
// Update the visual state
UpdateTargetState(pt);
}
}
}