I would like to self-draw the checkmark of a Checkbox, as explained here.
This requires setting the CheckBox to checkBox.Appearance = Appearance.Button
and then disabling the borders. Meaning, the CheckBox is now rendered as if it was a button. When it is checked, it is rendered as a depressed button.
Unfortunately, a depressed button has its text shifted slightly to the right and downwards. This behaviour is not commonly seen in a CheckBox.
var cb = new Checkbox();
cb.Paint += delegate (object sender, PaintEventArgs e)
{
// Here you can custom-draw the Checkmark.
// (but I'd like to fix the text-shifting first)
};
cb.Appearance = Appearance.Button;
cb.TextAlign = ContentAlignment.MiddleRight;
cb.FlatStyle = FlatStyle.Flat;
cb.FlatAppearance.BorderSize = 0;
Is it possible to configure a Button (or a CheckBox configured as Button) so that the text is not shifted when it is being depressed?