ComponentFactory.Krypton.Toolkit.ViewDrawMenuCheckBox.GetPreferredSize C# (CSharp) Method

GetPreferredSize() public method

Discover the preferred size of the element.
public GetPreferredSize ( ViewLayoutContext context ) : Size
context ViewLayoutContext Layout context.
return System.Drawing.Size
        public override Size GetPreferredSize(ViewLayoutContext context)
        {
            Debug.Assert(context != null);

            // Update text and image values
            _contentValues.ShortText = ResolveText;
            _contentValues.LongText = ResolveExtraText;
            _contentValues.Image = ResolveImage;
            _contentValues.ImageTransparentColor = ResolveImageTransparentColor;

            // Find new enabled state
            _itemEnabled = _provider.ProviderEnabled && ResolveEnabled;

            // Update with enabled state
            _drawContent.SetPalette(_itemEnabled ? (IPaletteContent)_checkBox.OverrideNormal : (IPaletteContent)_checkBox.OverrideDisabled);
            _drawContent.Enabled = _itemEnabled;
            _drawCheckBox.Enabled = _itemEnabled;

            // Update the checked state
            _drawCheckBox.CheckState = ResolveCheckState;

            return base.GetPreferredSize(context);
        }