Im currently working on a WinForms Application with VS2013 (.NET 4.5, c#) .
I'd like to use a CheckBox without any Label. If I empty the .Text property the bottom edge of the CheckBox is not displayed anymore.
In order to bypass that effect i tried to use a single empty space ' ' as Label. Now the visual aspect is correct, but whenever the CheckBox is pressed the focus switches onto the Label and shows the user empty space.
Is there a more elegant way to handle that problem rather than using a custom control and set the selectable property to false?
public class NonFocusCheckbox : CheckBox
{
public NonFocusCheckbox ()
{
SetStyle(ControlStyles.Selectable, false);
}
}
Note: This solution works, but seems a bit odd to be required to do that