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; } } }
protected virtual void OnDrawFirstSubItem(DrawListViewSubItemEventArgs e, Graphics g) { TextFormatFlags formatFlags = GetFormatFlags(e.Header.TextAlign); Rectangle bounds = e.Bounds; Image image = null; Size empty = Size.Empty; Rectangle rectangle = new Rectangle(bounds.X, bounds.Y, 0, 0); Rectangle rect = rectangle; Rectangle bounds2 = bounds; int num = 2; if (e.Item.ListView.CheckBoxes) { rectangle.X += num * 2; rectangle.Y = bounds.Top + (bounds.Height - _CheckBoxSize.Height) / 2; rectangle.Width = _CheckBoxSize.Width; rectangle.Height = _CheckBoxSize.Height; rect.X = rectangle.Right; bounds2.X = rectangle.Right; bounds2.Width -= _CheckBoxSize.Width - num * 2; GDIHelper.DrawCheckBox(g, new RoundRectangle(rectangle, 1)); if (e.Item.Checked) { GDIHelper.DrawCheckedStateByImage(g, rectangle); } } if (e.Item.ImageList != null && e.Item.ImageIndex >= 0) { image = e.Item.ImageList.Images[e.Item.ImageIndex]; empty = e.Item.ImageList.ImageSize; rect.X += num * 3; rect.Y = bounds.Y + num; int num4 = rect.Height = (rect.Width = bounds.Height - num * 2); bounds2.X = rect.Right; bounds2.Width -= num4 - num * 2; GDIHelper.DrawImage(g, rect, image, empty); } bounds2.X += num; bounds2.Width -= num * 2; Color foreColor = ((e.ItemState & ListViewItemStates.Selected) == ListViewItemStates.Selected) ? Color.White : e.SubItem.ForeColor; TextRenderer.DrawText(g, e.SubItem.Text, _Font, bounds2, foreColor, formatFlags); }
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) { ToolStrip toolStrip = e.ToolStrip; Graphics graphics = e.Graphics; GDIHelper.InitializeGraphics(graphics); Rectangle imageRectangle = e.ImageRectangle; if (toolStrip is ToolStripDropDown) { imageRectangle.Width -= 2; imageRectangle.Height -= 2; RoundRectangle roundRect = new RoundRectangle(imageRectangle, 1); GDIHelper.DrawCheckBox(graphics, roundRect); GDIHelper.DrawCheckedStateByImage(graphics, imageRectangle); } else { base.OnRenderItemCheck(e); } }