private void DrawBackGround(Graphics g) { GDIHelper.InitializeGraphics(g); Rectangle rect = new Rectangle(1, 1, base.Width - 3, base.Height - 3); RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(_CornerRadius)); switch (_ControlState) { case EnumControlState.Default: if (base.FlatStyle != 0) { GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.DefaultControlColor); GDIHelper.DrawPathBorder(g, roundRect); } break; case EnumControlState.HeightLight: GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.HeightLightControlColor); GDIHelper.DrawPathBorder(g, roundRect); break; case EnumControlState.Focused: GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.FocusedControlColor); GDIHelper.DrawPathBorder(g, roundRect); GDIHelper.DrawPathInnerBorder(g, roundRect); break; } }
private void DrawContent(Graphics g) { GDIHelper.InitializeGraphics(g); int width = base.Width; int height = base.Height; Rectangle rectangle = new Rectangle(_Margin, height / 2 - _BoxSize.Height / 2, _BoxSize.Width, _BoxSize.Height); Size size = g.MeasureString(Text, Font).ToSize(); Rectangle rect = default(Rectangle); rect.X = rectangle.Right + _Margin; rect.Y = _Margin; rect.Height = base.Height - _Margin * 2; rect.Width = size.Width; RoundRectangle roundRect = new RoundRectangle(rectangle, _CornerRadius); EnumControlState controlState = _ControlState; if (controlState == EnumControlState.HeightLight) { GDIHelper.DrawPathBorder(g, roundRect, SkinManager.CurrentSkin.OuterBorderColor); GDIHelper.DrawPathInnerBorder(g, roundRect, SkinManager.CurrentSkin.HeightLightControlColor.First); } else { GDIHelper.DrawCheckBox(g, roundRect); } Color forceColor = base.Enabled ? ForeColor : SkinManager.CurrentSkin.UselessColor; GDIHelper.DrawImageAndString(g, rect, null, Size.Empty, Text, Font, forceColor); switch (base.CheckState) { case CheckState.Checked: GDIHelper.DrawCheckedStateByImage(g, rectangle); break; case CheckState.Indeterminate: { Rectangle rect2 = rectangle; rect2.Inflate(-3, -3); Color color = Color.FromArgb(46, 117, 35); GDIHelper.FillRectangle(g, new RoundRectangle(rect2, _CornerRadius), color); break; } } }