/// <summary> /// Set the correct visual state of the target. /// </summary> /// <param name="pt">Mouse point.</param> protected virtual void UpdateTargetState(Point pt) { // By default the button is in the normal state PaletteState newState; // If the button is disabled then show as disabled if (!_target.Enabled) { newState = PaletteState.Disabled; } else { newState = PaletteState.Normal; // If capturing input.... if (_captured) { if (_target.ClientRectangle.Contains(pt)) { newState = PaletteState.Pressed; } else { newState = PaletteState.Tracking; } } else { // Only hot tracking, so show tracking only if mouse over the target if (_mouseOver) { newState = PaletteState.Tracking; } else { newState = PaletteState.Normal; } } } // If state has changed or change in (inside split area) if (_target.ElementState != newState) { if (newState == PaletteState.Tracking) { _target.Track(); } else { _target.Untrack(); } // Update target to reflect new state _target.ElementState = newState; // Redraw to show the change in visual state OnNeedPaint(true); } }