ComponentFactory.Krypton.Toolkit.PaletteBorderInheritRedirect.GetBorderDraw C# (CSharp) Method

GetBorderDraw() public method

Gets a value indicating if border should be drawn.
public GetBorderDraw ( PaletteState state ) : InheritBool
state PaletteState Palette value should be applicable to this state.
return InheritBool
        public override InheritBool GetBorderDraw(PaletteState state)
        {
            if (_overrideBorderToFalse)
                return InheritBool.False;
            else
                return _redirect.GetBorderDraw(_style, state);
        }

Usage Example

        private void PaintTab(int index, RenderContext renderContext)
        {
            bool Selected = (SelectedIndex == index);

            Rectangle tabRect = GetTabRect(index);

            if ((Appearance & TabAppearance.Normal) == TabAppearance.Normal)
            {
                tabRect.Inflate(0, Selected ? 2 : 1);
                tabRect.X += 1;
            }

            PaletteState State = default(PaletteState);

            if (Selected)
            {
                State = PaletteState.Pressed;
            }
            else
            {
                State = tabRect.Contains(PointToClient(MousePosition)) ? PaletteState.Tracking : PaletteState.Normal;
            }

            VisualOrientation visualOrientation = (VisualOrientation)Alignment;

            if (m_PaletteTabButtonBackground.GetBackDraw(State) == InheritBool.True)
            {
                using (GraphicsPath BackPath = m_Renderer.RenderStandardBorder.GetBackPath(renderContext, tabRect, m_PaletteTabButtonBorder, visualOrientation, State))
                {
                    m_MementoTabButtonBackground = m_Renderer.RenderStandardBack.DrawBack(renderContext, tabRect, BackPath, m_PaletteTabButtonBackground, visualOrientation, State, m_MementoTabButtonBackground);
                }
            }

            if (m_PaletteTabButtonBorder.GetBorderDraw(State) == InheritBool.True)
            {
                m_Renderer.RenderStandardBorder.DrawBorder(renderContext, tabRect, m_PaletteTabButtonBorder, visualOrientation, State);
            }
            else if (Selected)
            {
                using (Pen PBorder = new Pen(m_PaletteTabPageBorder.GetBorderColor1(PaletteState.Normal)))
                {
                    Rectangle RBorder = tabRect;
                    RBorder.Width -= 1;

                    renderContext.Graphics.DrawRectangle(PBorder, RBorder);
                }
            }

            // (TODO: adjust rendering for other Appearance settings)

            if (ImageList != null)
            {
                Image tabImage = null;

                if (TabPages[index].ImageIndex != -1)
                {
                    int imageIndex = TabPages[index].ImageIndex;
                    tabImage = ImageList.Images[imageIndex];
                }
                else if (TabPages[index].ImageKey != null)
                {
                    string imageKey = TabPages[index].ImageKey;
                    tabImage = ImageList.Images[imageKey];
                }

                if (tabImage != null)
                {
                    int x = tabRect.X + (tabImage.Width / 2);
                    int y = tabRect.Y + (tabRect.Height - tabImage.Height) / 2;

                    renderContext.Graphics.DrawImage(tabImage, x, y);

                    tabRect.X     += tabImage.Width;
                    tabRect.Width -= tabImage.Width;
                }
            }

            if (m_TabFont == null || (!object.ReferenceEquals(m_TabFont, g_TabFontBold) & !object.ReferenceEquals(m_TabFont, g_TabFontRegular)))
            {
                if (renderContext.Graphics.MeasureString(TabPages[index].Text, g_TabFontBold, tabRect.X, g_StringFormat).Width <= tabRect.Width)
                {
                    m_TabFont = g_TabFontBold;
                }
                else
                {
                    m_TabFont = g_TabFontRegular;
                }
            }

            renderContext.Graphics.DrawString(TabPages[index].Text, m_TabFont, m_TabBrush, tabRect, g_StringFormat);
        }