public override void PaintExpandCollapseButton(PaintEventArgs args, ThemedExpandCollapseButton button) { Color outlineColor = Color.FromArgb(182, 182, 182); Brush textBrush = new SolidBrush(Color.FromArgb(75, 75, 75)); DrawButtonBackground(args, button); Control parentForm = button.Parent; if (parentForm != null) { Point mousePoint = parentForm.PointToClient(Cursor.Position); if (!button.Enabled) { textBrush = new SolidBrush(outlineColor); } else if (button.Bounds.Contains(mousePoint)) { textBrush = new SolidBrush(Color.FromArgb(75, 75, 75)); } } Bitmap icon = null; if (button.ExpandedState) { icon = button.CollapsedIcon; } if (!button.ExpandedState) { icon = button.ExpandIcon; } SizeF textSize = args.Graphics.MeasureString(button.Text, button.Font); if (icon != null) { textSize.Width += icon.Width + 3; } if (button.Font == null || button.Text == null) { return; } args.Graphics.DrawString(button.Text, button.Font, textBrush, new PointF(button.Width / 2 - textSize.Width / 2 + icon.Width + 3, button.Height / 2 - textSize.Height / 2)); if (icon != null) { args.Graphics.DrawImage(icon, new PointF(button.Width / 2 - textSize.Width / 2, button.Height / 2 - icon.Height / 2)); } }
public abstract void PaintExpandCollapseButton(PaintEventArgs args, ThemedExpandCollapseButton button);