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 cb is not displayed any more. In order to bypass that effect i tried to use a single empty space ' ' as label. Now the visual aspect is correct, but whenver 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
Aucun commentaire:
Enregistrer un commentaire