ComponentFactory.Krypton.Toolkit.ButtonSpec.GetStyle C# (CSharp) Method

GetStyle() public method

Gets the button style.
public GetStyle ( IPalette palette ) : ButtonStyle
palette IPalette Palette to use for inheriting values.
return ButtonStyle
        public virtual ButtonStyle GetStyle(IPalette palette)
        {
            if (Style != PaletteButtonStyle.Inherit)
                return ConvertToButtonStyle(Style);
            else
                return ConvertToButtonStyle(palette.GetButtonSpecStyle(_type));
        }

Usage Example

        private Color OverrideImageColor(PaletteState state)
        {
            // We only intercept if we have a content to use for redirection
            if (PaletteContent != null)
            {
                // We only override the normal/disabled states
                if ((state == PaletteState.Normal) ||
                    (state == PaletteState.Disabled))
                {
                    // ReSharper disable RedundantBaseQualifier
                    // Get the color map from the button spec
                    Color mapColor = _buttonSpec.GetColorMap(base.Target);
                    // ReSharper restore RedundantBaseQualifier

                    // If we are supposed to remap a color
                    if (mapColor != Color.Empty)
                    {
                        // ReSharper disable RedundantBaseQualifier
                        // Get the button style requested
                        ButtonStyle buttonStyle = _buttonSpec.GetStyle(base.Target);
                        // ReSharper restore RedundantBaseQualifier

                        // Only for ButtonSpec do we use the palette value
                        if (buttonStyle == ButtonStyle.ButtonSpec)
                        {
                            return(mapColor);
                        }
                    }
                }
            }

            return(Color.Empty);
        }
All Usage Examples Of ComponentFactory.Krypton.Toolkit.ButtonSpec::GetStyle