I want to set binary values on and of at will. So I derived from the CheckBox class to change it's appearance. Instead of a checkmark I like to implement a 0 or 1 here.
This is the code of my class so far:
class BinarycheckBox : CheckBox
{
public BinarycheckBox()
{
}
}
Nothing special, I expected to get a normal checkbox with the following:
public partial class Form1 : Form
{
private BinarycheckBox BinCB;
public Form1()
{
InitializeComponent();
//initialize new binary checkbox
this.BinCB = new BinarycheckBox();
this.BinCB.AutoSize = true;
this.BinCB.Location = new System.Drawing.Point(70, 95);
this.BinCB.Name = "bin";
this.BinCB.Size = new System.Drawing.Size(80, 17);
this.BinCB.TabIndex = 0;
this.BinCB.Text = "bin";
this.BinCB.UseVisualStyleBackColor = true;
this.BinCB.Visible = true; //even this does not work
}
}
This compiles and runs perfectly, but no checkbox is showing. What am I overlooking here? Any help will be much appreciated.