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

GetCheckBoxPreferredSize() public method

Calculate the requested display size for the check box.
public GetCheckBoxPreferredSize ( ViewLayoutContext context, IPalette palette, bool enabled, CheckState checkState, bool tracking, bool pressed ) : Size
context ViewLayoutContext Render context.
palette IPalette Palette for sourcing display values.
enabled bool Should check box be displayed as enabled.
checkState CheckState The checked state of the check box.
tracking bool Should check box be displayed as hot tracking.
pressed bool Should check box be displayed as pressed.
return System.Drawing.Size
        public override Size GetCheckBoxPreferredSize(ViewLayoutContext context,
                                                      IPalette palette,
                                                      bool enabled,
                                                      CheckState checkState,
                                                      bool tracking,
                                                      bool pressed)
        {
            Debug.Assert(context != null);
            Debug.Assert(palette != null);

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

            // Grab an image appropriate to the state
            Image drawImage = palette.GetCheckBoxImage(enabled, checkState, tracking, pressed);

            // If no image from the palette then get a system check box
            if (drawImage == null)
            {
                // Convert incoming parameters to check box state
                CheckBoxState state = DiscoverCheckBoxState(enabled, checkState, tracking, pressed);

                // Request the drawing size of the check box glyph
                return CheckBoxRenderer.GetGlyphSize(context.Graphics, state);
            }
            else
                return drawImage.Size;
        }
RenderStandard