/// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="imageValue"></param>
        /// <param name="commandLinkTextValues"></param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawCommandLinkButton(IPaletteTriple paletteDisabled,
                                         IPaletteTriple paletteNormal,
                                         IPaletteTriple paletteTracking,
                                         IPaletteTriple palettePressed,
                                         IPaletteTriple paletteCheckedNormal,
                                         IPaletteTriple paletteCheckedTracking,
                                         IPaletteTriple paletteCheckedPressed,
                                         IPaletteMetric paletteMetric,
                                         ImageValue imageValue, CommandLinkTextValues commandLinkTextValues,
                                         VisualOrientation orientation,
                                         bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled        = paletteDisabled;
            _paletteNormal          = paletteNormal;
            _paletteTracking        = paletteTracking;
            _palettePressed         = palettePressed;
            _paletteCheckedNormal   = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed  = paletteCheckedPressed;
            CurrentPalette          = _paletteNormal;

            // Default to not being checked
            Checked      = false;
            AllowUncheck = true;

            // Create the drop down view
            _drawImageContent = new ViewDrawContent(_paletteNormal.PaletteContent, imageValue, orientation);
            _drawImage        = new ViewLayoutCenter(paletteMetric, PaletteMetricPadding.BarPaddingOnly,
                                                     orientation, _drawImageContent);

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, commandLinkTextValues, orientation)
            {
                // Pass the mnemonic default to the content view
                UseMnemonic = useMnemonic
            };

            // Use a docker layout to organize the contents of the canvas
            LayoutDocker = new ViewLayoutDocker
            {
                { _drawContent, ViewDockStyle.Left },
                { _drawImage, ViewDockStyle.Left }
            };
            LayoutDocker.Tag = this;


            _drawCanvas = new ViewDrawCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric,
                                             PaletteMetricPadding.BarPaddingTabs, orientation)
            {
                // Place the content inside the canvas
                LayoutDocker
            };

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
 /// <summary>
 /// Initialize a new instance of the ViewDrawButton class.
 /// </summary>
 /// <param name="paletteDisabled">Palette source for the disabled state.</param>
 /// <param name="paletteNormal">Palette source for the normal state.</param>
 /// <param name="paletteTracking">Palette source for the tracking state.</param>
 /// <param name="palettePressed">Palette source for the pressed state.</param>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="imageValue"></param>
 /// <param name="commandLinkTextValues"></param>
 /// <param name="orientation">Visual orientation of the content.</param>
 /// <param name="useMnemonic">Use mnemonics.</param>
 public ViewDrawCommandLinkButton(IPaletteTriple paletteDisabled,
                                  IPaletteTriple paletteNormal,
                                  IPaletteTriple paletteTracking,
                                  IPaletteTriple palettePressed,
                                  IPaletteMetric paletteMetric,
                                  ImageValue imageValue, CommandLinkTextValues commandLinkTextValues,
                                  VisualOrientation orientation,
                                  bool useMnemonic)
     : this(paletteDisabled, paletteNormal, paletteTracking, palettePressed,
            paletteNormal, paletteTracking, palettePressed, paletteMetric,
            imageValue, commandLinkTextValues, orientation, useMnemonic)
 {
 }
        /// <summary>
        /// Initialize a new instance of the KryptonButton class.
        /// </summary>
        public KryptonCommandLinkButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default button properties
            base.AutoSize = false;
            DialogResult  = DialogResult.None;
            _orientation  = VisualOrientation.Top;
            _useMnemonic  = true;

            // Create content storage
            CommandLinkImageValue = new ImageValue(NeedPaintDelegate);
            CommandLinkTextValues = new CommandLinkTextValues(NeedPaintDelegate);

            // Create the palette storage
            StateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            PaletteContentText contentShortText = StateCommon.Content.ShortText;

            contentShortText.Font              = new Font(@"Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
            contentShortText.TextH             = PaletteRelativeAlign.Near;
            contentShortText.TextV             = PaletteRelativeAlign.Center;
            StateCommon.Content.LongText.TextH = PaletteRelativeAlign.Near;
            StateCommon.Content.LongText.TextV = PaletteRelativeAlign.Far;

            StateDisabled                     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateNormal                       = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateTracking                     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StatePressed                      = new PaletteTriple(StateCommon, NeedPaintDelegate);
            OverrideDefault                   = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            OverrideFocus                     = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            OverrideFocus.Border.Draw         = InheritBool.True;
            OverrideFocus.Border.DrawBorders  = PaletteDrawBorders.All;
            OverrideFocus.Border.GraphicsHint = PaletteGraphicsHint.AntiAlias;
            // Force style update
            ButtonStyle = ButtonStyle.Command;

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(OverrideDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);

            // Create the view button instance
            drawButton = new ViewDrawCommandLinkButton(StateDisabled,
                                                       _overrideNormal,
                                                       _overrideTracking,
                                                       _overridePressed,
                                                       new PaletteMetricRedirect(Redirector),
                                                       CommandLinkImageValue, CommandLinkTextValues,
                                                       Orientation,
                                                       UseMnemonic)
            {
                // Only draw a focus rectangle when focus cues are needed in the top level form
                TestForFocusCues = true
            };

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(drawButton, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a button
            drawButton.MouseController  = _buttonController;
            drawButton.KeyController    = _buttonController;
            drawButton.SourceController = _buttonController;

            // Need to know when user clicks the button view or mouse selects it
            _buttonController.Click       += OnButtonClick;
            _buttonController.MouseSelect += OnButtonSelect;

            // Create the view manager instance
            ViewManager = new ViewManager(this, drawButton);
        }