ComponentFactory.Krypton.Ribbon.LeftDownButtonController.UpdateTargetState C# (CSharp) Method

UpdateTargetState() protected method

Set the correct visual state of the target.
protected UpdateTargetState ( ) : void
return void
        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();
            }
        }