i got a Class called AdvancePanle that drived from Panle, and i got a class call AdvnaceCheckBox that drived from CheckBox.
I created a AdvancePanle in my Form, and now i want to add some AdvnaceCheckBox’s to it.
so i created this, simple method:
private void addCheckBox()
{
AdvancedCheckBox checkbox;
for (int i = 0; i < 10; i++)
{
checkbox = new AdvancedCheckBox();
checkbox.Location = new Point(0, i + 5);
checkbox.Text = "bla" + i;
selectablePanel1.Controls.Add(checkbox);
}
}
and i call this method in the Form onLoad:
protected override void OnLoad(EventArgs e)
{
addCheckBox();
selectablePanel1.AutoScroll = true;
base.OnLoad(e);
}
but afther the Form is opened, I can see only 1 CheckBox in the Panle.
i tried playing with the position, but i alwys see only 1 checkbox.
am I adding the CheckBoxs in a worng way?
(sorry for my english)
You’re placing them too close to each other.
(0, 5+i)will evaluate to:Try this instead:
or this: