I was wondering how you make a CheckBox
unselectable in c#? I thought it would be something like SetSelectable (false) or something but I can\'t seem to see th
You can create one by using following code
public class ReadOnlyCheckBox : System.Windows.Forms.CheckBox
{
private bool readOnly;
protected override void OnClick(EventArgs e)
{
// pass the event up only if its not readlonly
if (!ReadOnly) base.OnClick(e);
}
public bool ReadOnly
{
get { return readOnly; }
set { readOnly = value; }
}
}
or also you can handle the checked change event and always set it back to value you want