我动态创建多个checkbox 规定好一行显示的个数,但是在checkbox总的个数不确定下,我不知道怎样分行显示checkbox,请帮帮我,多谢啦!
解决方案 »
- 如何根据指定的名称获取到控件
- 添加sql数据库碰到一点小问题,请高手指点下
- 反序列化时如何识别类型
- 做权限模块 权限列表显示问题
- 菜鸟求助C#问题
- 如何查看或者记录一个程序所调用的系统API函数??
- C#环境下的web开发中如何往脚本代码中存放变量?急呀....
- 困惑,C#内的char是一个字节或是两个字节?
- 如何判断值是否为空,
- 关于Microsoft.Exchange.WebServices.Data.ExchangeService的错误,请大神指教
- 在一台不与外界连接的物理主机中,如何在虚拟机中安装一个Microsoft Loopback Adapter来与物理主机中的Microsoft Loopback Adapter组成一个单独的网络,以实现虚拟机访问物理主机的数据库。
- 求助
int chkheight = 20;
int noofeachline = 3;//没行个数
int noofcheck = 13;//总个数
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < noofcheck; i++)
{
CheckBox tmchk = new CheckBox();
tmchk.Text = "check" + i.ToString();
tmchk.Left = (i % noofeachline) * 80 + 5;
tmchk.Top = (int)(i / noofeachline) * 20 + 5;
tmchk.Width = chkwidth;
this.Controls.Add(tmchk);
}
}
int chkwidth = 80;//宽
int chkheight = 20;//高
int noofeachline = 3;//没行个数
int noofcheck = 13;//总个数
int tmint = 8;//行间距 和 列间距
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < noofcheck; i++)
{
CheckBox tmchk = new CheckBox();
tmchk.Text = "check" + i.ToString();
tmchk.Left = (i % noofeachline) * chkwidth + tmint;
tmchk.Top = (int)(i / noofeachline) * chkheight + tmint;
tmchk.Width = chkwidth;
tmchk.Height = chkheight;
this.Controls.Add(tmchk);
}
}