日期:2014-05-17  浏览次数:20885 次

如何获取flowLayoutPanel中所有选中checkbox的text?
本帖最后由 wjx515628 于 2013-09-05 01:59:24 编辑
  private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                Panel pan = new Panel();
                pan.Width = 150;
                pan.Height = 150;
                pan.BackColor = System.Drawing.Color.Yellow;
                flowLayoutPanel1.Controls.Add(pan);

                PictureBox pic = new PictureBox();
                pic.Width = 150;
                pic.Height = 130;
                Image O_Image = Image.FromStream(WebRequest.Create("http://www.baidu.com/img/baidu_logo.gif").GetResponse().GetResponseStream());
                pic.Image = O_Image;
                pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
                pan.Controls.Add(pic);

                CheckBox chk2 = new CheckBox();
                chk2.Width = 70;
                chk2.Text = "test" + i.ToString(); chk2.Checked = (i % 1 == 0); chk2.Visible = true;
                chk2.Top = 130;
                chk2.Width = 13;