protected virtual void UpdateTargetState()
{
// By default the button is in the normal state
PaletteState newState = PaletteState.Normal;
// Only allow another state if the ribbon is enabled
if (_ribbon.Enabled)
{
// Are we showing with the fixed state?
if (_fixedPressed)
newState = PaletteState.Pressed;
else
{
// If being pressed
if (_mouseDown)
newState = PaletteState.Pressed;
else if (_mouseOver && _active)
newState = PaletteState.Tracking;
}
}
// Only interested in changes of state
if (_target.ElementState != newState)
{
// Update state
_target.ElementState = newState;
// Need to repaint just the target client area
OnNeedPaint(false, _target.ClientRectangle);
// Get the repaint to happen immediately
if (!_ribbon.InKeyboardMode)
Application.DoEvents();
}
}