Button Suite
A check box that draws its own box, tick and text, in colours you choose – a crisp, flat check box that looks the same on every version of Windows and at every display scale.
Assembly
| Assembly | Binarymission.WinForms.Controls.BinaryButtonSuite.dll |
| Root namespace | Binarymission.WinForms.Controls.ButtonControls |
| Target frameworks | .NET Framework 4.8, .NET 6 / 8 / 10 |
Overview
It is a CheckBox in every other way: CheckBox.Checked,
CheckBox.CheckState, CheckBox.ThreeState, the
CheckBox.CheckedChanged event, the keyboard and the accessibility all work as usual.
Only the picture changes.
Colours
NormalControlColordraws the box and the tick, black by default.OnFocusControlColortakes over while the pointer is over the control or it has the keyboard focus, the system highlight colour by default – so the control answers the pointer.ControlBackColorfills the inside of the box, the window colour by default.- The control's own
Control.BackColorfills the area round the box and the text, andControl.ForeColorcolours the text.
A disabled check box is drawn with a grey box on the system control colour and grey text.
Size and layout
The box grows with the font (to about four fifths of the font's height, and never below 11
logical pixels), and stays sharp at any display scale because it is drawn, not copied from an image.
CheckBox.CheckAlign, TextAlign,
Control.Padding and Control.RightToLeft place the box and the text as on a
standard check box.
An indeterminate check box (Indeterminate) is drawn with the same tick
as a checked one.
Getting started
Two options on an export dialog, in the application's brand colours.
using System;
using System.Drawing;
using System.Windows.Forms;
using Binarymission.WinForms.Controls.ButtonControls;
public class ExportOptionsForm : Form
{
private readonly ExtendedCheckBox _includeInvoices = new ExtendedCheckBox();
private readonly ExtendedCheckBox _zipFiles = new ExtendedCheckBox();
public ExportOptionsForm()
{
Text = "Export orders";
_includeInvoices.Text = "Include invoices (PDF)";
_includeInvoices.Location = new Point(16, 16);
_includeInvoices.AutoSize = true;
_includeInvoices.Checked = true;
_includeInvoices.NormalControlColor = Color.FromArgb(0, 84, 147);
_includeInvoices.OnFocusControlColor = Color.FromArgb(0, 120, 212);
_includeInvoices.ControlBackColor = Color.AliceBlue;
_zipFiles.Text = "Compress into a single .zip file";
_zipFiles.Location = new Point(16, 44);
_zipFiles.AutoSize = true;
_zipFiles.NormalControlColor = Color.FromArgb(0, 84, 147);
_zipFiles.OnFocusControlColor = Color.FromArgb(0, 120, 212);
_zipFiles.CheckedChanged += (sender, e) => Console.WriteLine("Zip: " + _zipFiles.Checked);
Controls.Add(_includeInvoices);
Controls.Add(_zipFiles);
}
}API reference
Binarymission.WinForms.Controls.ButtonControls
class ExtendedCheckBox | A check box that draws its own box, tick and text, in colours you choose - a crisp, flat check box that looks the same on every version of Windows and at every display scale. |
class ExtendedRadioButton | A radio button that draws its own circle, dot and text, in colours you choose - a crisp, flat radio button that looks the same on every version of Windows and at every display scale. |