请问在C#中tabpage控件中动态添加一些单选按钮后,如何让他们不重叠在一起
2个回答
展开全部
你得指定CheckBox的初始位置,向下面一样
private void button1_Click(object sender, EventArgs e)
{
CheckBox checkBox1 = new CheckBox();
CheckBox checkBox2 = new CheckBox();
CheckBox checkBox3 = new CheckBox();
checkBox1.Text = "AA";
checkBox2.Text = "BB";
checkBox3.Text = "CC";
tabControl1.TabPages[0].Controls.Add(checkBox1);
tabControl1.TabPages[0].Controls.Add(checkBox2);
tabControl1.TabPages[0].Controls.Add(checkBox3);
checkBox1.Location = new Point(50, 20);
checkBox2.Location = new Point(50, 50);
checkBox3.Location = new Point(50, 80);
}
private void button1_Click(object sender, EventArgs e)
{
CheckBox checkBox1 = new CheckBox();
CheckBox checkBox2 = new CheckBox();
CheckBox checkBox3 = new CheckBox();
checkBox1.Text = "AA";
checkBox2.Text = "BB";
checkBox3.Text = "CC";
tabControl1.TabPages[0].Controls.Add(checkBox1);
tabControl1.TabPages[0].Controls.Add(checkBox2);
tabControl1.TabPages[0].Controls.Add(checkBox3);
checkBox1.Location = new Point(50, 20);
checkBox2.Location = new Point(50, 50);
checkBox3.Location = new Point(50, 80);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询