ComponentFactory.Krypton.Toolkit.RenderStandard.GetBorderRawPadding C# (CSharp) Method

GetBorderRawPadding() public method

Gets the raw padding used per edge of the border.
public GetBorderRawPadding ( IPaletteBorder palette, PaletteState state, VisualOrientation orientation ) : Padding
palette IPaletteBorder Palette used for drawing.
state PaletteState State associated with rendering.
orientation VisualOrientation Visual orientation of the border.
return Padding
        public override Padding GetBorderRawPadding(IPaletteBorder palette,
                                                    PaletteState state,
                                                    VisualOrientation orientation)
        {
            Debug.Assert(palette != null);

            // Validate parameter reference
            if (palette == null) throw new ArgumentNullException("palette");

            PaletteDrawBorders borders = palette.GetBorderDrawBorders(state);

            // If there is at least one border to be drawn
            if (CommonHelper.HasABorder(borders))
            {
                int borderWidth = palette.GetBorderWidth(state);

                switch (borders)
                {
                    case PaletteDrawBorders.Bottom:
                        return new Padding(0, 0, 0, borderWidth);
                    case PaletteDrawBorders.BottomLeft:
                        return new Padding(borderWidth, 0, 0, borderWidth);
                    case PaletteDrawBorders.BottomLeftRight:
                        return new Padding(borderWidth, 0, borderWidth, borderWidth);
                    case PaletteDrawBorders.BottomRight:
                        return new Padding(0, 0, borderWidth, borderWidth);
                    case PaletteDrawBorders.Left:
                        return new Padding(borderWidth, 0, 0, 0);
                    case PaletteDrawBorders.LeftRight:
                        return new Padding(borderWidth, 0, borderWidth, 0);
                    case PaletteDrawBorders.Top:
                        return new Padding(0, borderWidth, 0, 0);
                    case PaletteDrawBorders.Right:
                        return new Padding(0, 0, borderWidth, 0);
                    case PaletteDrawBorders.TopBottom:
                        return new Padding(0, borderWidth, 0, borderWidth);
                    case PaletteDrawBorders.TopBottomLeft:
                        return new Padding(borderWidth, borderWidth, 0, borderWidth);
                    case PaletteDrawBorders.TopBottomRight:
                        return new Padding(0, borderWidth, borderWidth, borderWidth);
                    case PaletteDrawBorders.TopLeft:
                        return new Padding(borderWidth, borderWidth, 0, 0);
                    case PaletteDrawBorders.TopLeftRight:
                        return new Padding(borderWidth, borderWidth, borderWidth, 0);
                    case PaletteDrawBorders.TopRight:
                        return new Padding(0, borderWidth, borderWidth, 0);
                    case PaletteDrawBorders.All:
                        return new Padding(borderWidth);
                    default:
                        // Should never happen!
                        Debug.Assert(false);
                        return Padding.Empty;
                }
            }
            else
                return Padding.Empty;
        }
RenderStandard