Reputation: 10781
I'm writing an app to replace some paper-based testing forms. These forms have checkboxes that the tester marks with either a check or an X depending on the test result. How would I go about getting this visual feel from a winforms checkbox?
Upvotes: 2
Views: 4959
Reputation: 36522
Enable the ThreeState
property.
If for the "Indeterminate" state, you would rather have an "X", you can paint this yourself (using the control's paint event). One example:
private void checkBox1_Paint(object sender, PaintEventArgs e)
{
CheckBox s = (CheckBox)sender;
if (s.CheckState == CheckState.Indeterminate)
e.Graphics.DrawString("X", s.Font, Brushes.Black, new Point(1, 1));
}
You can of course draw some lines or something more graphical. Cheers!
Upvotes: 8