星空网 > 软件开发 > ASP.net

csharp:FlowLayoutPanel

 /// <summary>    /// 添加控件方法    /// </summary>    /// <returns></returns>    public System.Windows.Forms.TextBox AddNewTextBox()    {      Point p = new Point();      System.Windows.Forms.ComboBox cmb = new ComboBox();      cmb.DataSource = setCmb();            cmb.ValueMember = "id";      cmb.DisplayMember = "name";            this.Controls.Add(cmb);      cmb.Top = cLeft * 25;      cmb.Size = new System.Drawing.Size(121, 20);      cmb.Left = 2;      flowLayoutPanel2.Controls.Add(cmb);      System.Windows.Forms.TextBox txt = new System.Windows.Forms.TextBox();      this.Controls.Add(txt);      txt.Top = cLeft * 25;      txt.Left = 200;      txt.Text = "TextBox" + this.cLeft.ToString();      cLeft = cLeft + 1;      flowLayoutPanel2.Controls.Add(txt);      return txt;    }    /// <summary>    /// 添加控件    /// </summary>    /// <param name="sender"></param>    /// <param name="e"></param>    private void button1_Click(object sender, EventArgs e)    {      AddNewTextBox();    }    /// <summary>    /// 获取控件的值    /// 涂聚文20150339    /// Geovin Du    /// </summary>    /// <param name="sender"></param>    /// <param name="e"></param>    private void button2_Click(object sender, EventArgs e)    {      //((TextBox)this.flowLayoutPanel2.Controls[2]).Text = "geovindu"; //设置值      //string s = ((TextBox)this.flowLayoutPanel2.Controls[2]).Text.Trim();      //MessageBox.Show(s);      string s = string.Empty;      for (int i = 0; i < flowLayoutPanel2.Controls.Count; i++)      {        if (flowLayoutPanel2.Controls[i].GetType() == typeof(TextBox))        {          s = s + ((TextBox)this.flowLayoutPanel2.Controls[i]).Text.Trim() + ";";        }      }       MessageBox.Show(s);      foreach (Control control in flowLayoutPanel2.Controls)      {        if (control.GetType() == typeof(ComboBox)) //按类型查找        {          ComboBox cb = control as ComboBox; //转换为具体控件类型          cb.SelectedText.ToString();        }        //if (control.Name == "ComboBox2") //查找某Name的控件        //{        //  MessageBox.Show("我是名为pictureBox2的控件");        //}      }          }

  




原标题:csharp:FlowLayoutPanel

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

如何设置亚马逊coupon做好站外营销:https://www.ikjzd.com/articles/35
直评风波再起?2018年亚马逊出路在哪?:https://www.ikjzd.com/articles/350
卖家注意,你价值上万的货物可能有危险!:https://www.ikjzd.com/articles/351
Amazon发布最新消息,站点免半年月租费?:https://www.ikjzd.com/articles/3511
Facebook疑在华成立全资子公司,意欲抢占中国社交媒体市场?:https://www.ikjzd.com/articles/3514
Wish爆款产品的Tags是怎样写出来的:https://www.ikjzd.com/articles/3519
川藏线自驾游要怎么走才比较划算呢?:https://www.vstour.cn/a/411240.html
去日本入住酒店,东西随意用却有一个特殊“要:https://www.vstour.cn/a/411241.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流