国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

csharp:FlowLayoutPanel

2019-11-17 02:29:08
字體:
來源:轉載
供稿:網友

csharp:FlowLayoutPanel

        /// <summary>        /// 集合添加的控件        /// 涂聚文20150339        /// </summary>        public void AddNewTextBox()        {            Point p = new Point();            Label lb1 = new Label();            this.Controls.Add(lb1);            lb1.Text = "關系名稱";            lb1.Top = cLeft * 25;            lb1.RightToLeft = RightToLeft.Yes;            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(lb1);            System.Windows.Forms.ComboBox cmb = new ComboBox();            relationshipTypeViewTitile.SetCombox(cmb);            this.Controls.Add(cmb);            cmb.Top = cLeft * 25;            cmb.Size = new System.Drawing.Size(121, 20);            cmb.Left = 2;            flowLayoutPanel1.Controls.Add(cmb);            Label lb2 = new Label();            this.Controls.Add(lb2);            lb2.Text = "關系人姓名";            lb2.Top = cLeft * 25;            lb2.RightToLeft = RightToLeft.Yes;            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(lb2);            System.Windows.Forms.TextBox txtName = new System.Windows.Forms.TextBox();            this.Controls.Add(txtName);            txtName.Name = "txtName";            txtName.Top = cLeft * 25;            txtName.Left = 200;            txtName.Text = "";// "TextBox" + this.cLeft.ToString();            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(txtName);            Label lbtel = new Label();            this.Controls.Add(lbtel);            lbtel.Text = "關系人電話";            lbtel.Top = cLeft * 25;            lbtel.RightToLeft = RightToLeft.Yes;            lbtel.Left = 200;            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(lbtel);            System.Windows.Forms.TextBox txtTel = new System.Windows.Forms.TextBox();            this.Controls.Add(txtTel);            txtTel.Name = "txtTel";            txtTel.Top = cLeft * 25;            txtTel.Left = 200;            txtTel.Text = "";// "TextBox" + this.cLeft.ToString();            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(txtTel);            Label lb4 = new Label();            this.Controls.Add(lb4);            lb4.Text = "關系人生出日期";            lb4.RightToLeft = RightToLeft.Yes;            lb4.Top = cLeft * 25;            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(lb4);            System.Windows.Forms.DateTimePicker dtime = new System.Windows.Forms.DateTimePicker();            dtime.Size = new Size(155, 30);            this.Controls.Add(dtime);            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(dtime);            Label lb5 = new Label();            this.Controls.Add(lb5);            lb5.Text = "關系人描述";            lb5.Top = cLeft * 25;            lb5.RightToLeft = RightToLeft.Yes;            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(lb5);            System.Windows.Forms.TextBox txtRelationDesc = new System.Windows.Forms.TextBox();            this.Controls.Add(txtRelationDesc);            txtRelationDesc.Name = "txtRelationDesc";            txtRelationDesc.Top = cLeft * 25;            txtRelationDesc.Left = 200;            txtRelationDesc.Text = "";// "TextBox" + this.cLeft.ToString();            cLeft = cLeft + 1;            flowLayoutPanel1.Controls.Add(txtRelationDesc);        }        /// <summary>        /// 添加控件事件        /// 涂聚文20150339        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        PRivate void button1_Click(object sender, EventArgs e)        {            AddNewTextBox();        }        /// <summary>        /// 獲取添的控件的值        /// 涂聚文20150339        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button2_Click(object sender, EventArgs e)        {             int s = 0;            int k = 0;            int n = 0;            for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)            {                if (flowLayoutPanel1.Controls[i].GetType() == typeof(ComboBox)) //按類型查找                {                    customerRelationTypeID = ((ComboBox)this.flowLayoutPanel1.Controls[i]).SelectedValue.ToString();                }                if (flowLayoutPanel1.Controls[i].GetType() == typeof(TextBox))                {                    //MessageBox.Show(((TextBox)this.flowLayoutPanel1.Controls[i]).Name);                    if (((TextBox)this.flowLayoutPanel1.Controls[i]).Name.Contains("txtName"))                    {                        customerRelationName = ((TextBox)this.flowLayoutPanel1.Controls[i]).Text.Trim();                    }                    if (((TextBox)this.flowLayoutPanel1.Controls[i]).Name.Contains("txtTel"))                    {                        customerRelationTel = ((TextBox)this.flowLayoutPanel1.Controls[i]).Text.Trim();                    }                    if (((TextBox)this.flowLayoutPanel1.Controls[i]).Name.Contains("txtRelationDesc"))                    {                        customerRelationDesc = ((TextBox)this.flowLayoutPanel1.Controls[i]).Text.Trim();                    }                }                if (flowLayoutPanel1.Controls[i].GetType() == typeof(DateTimePicker)) //按類型查找                {                    customerBirthday = ((DateTimePicker)this.flowLayoutPanel1.Controls[i]).Value;                }                if (IsOdd5(i))                {                    customerRelationContactsId = CustomerRelationContactsId;                    if (Operator == 1)                    {                        customerRelationshipListInfo.CustomerBirthday = customerBirthday;                        customerRelationshipListInfo.CustomerRelationContactsId = customerRelationContactsId;                        customerRelationshipListInfo.CustomerRelationDesc = customerRelationDesc;                        customerRelationshipListInfo.CustomerRelationName = customerRelationName;                        customerRelationshipListInfo.CustomerRelationTel = customerRelationTel;                        customerRelationshipListInfo.CustomerRelationTypeID = customerRelationTypeID;                        k = customerRelationshipListBLL.InsertCustomerRelationshipList(customerRelationshipListInfo);                        //MessageBox.Show(customerRelationTypeID + customerRelationName + customerRelationTel);                        n++;                    }                }            }            if (n > 0)            {                DialogResult dresult = MessageBox.Show("添加了" + n.ToString() + "條聯系人", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                if (dresult == DialogResult.OK)                {                    this.Close();                    this.DialogResult = DialogResult.OK;                }            }            else            {                DialogResult dresult = MessageBox.Show("存在問題,添加了" + n.ToString() + "條聯系人", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Error);                if (dresult == DialogResult.No)                {                    this.Close();                    this.DialogResult = DialogResult.OK;                }                if (dresult == DialogResult.Yes)                {                    return;                }            }        }        /// <summary>        /// 判斷奇偶數的函數        /// </summary>        /// <param name="n"></param>        /// <returns></returns>        public static bool IsOdd2(int n)        {            return Convert.ToBoolean(n % 2);        }        /// <summary>        ///         /// </summary>        /// <param name="n"></param>        /// <returns></returns>        public static bool IsOdd5(int n)        {            int b = 0;            bool isb = false;            b = n % 9;            if (n > 0)            {                if (b == 0)                {                    isb = true;                }            }            return isb;        }

  


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 林西县| 华容县| 西乌| 仪陇县| 杭锦后旗| 沭阳县| 大关县| 伊春市| 青龙| 奉化市| 平湖市| 界首市| 潮安县| 环江| 石嘴山市| 莱阳市| 神池县| 明星| 安岳县| 玉门市| 泾阳县| 都江堰市| 靖安县| 略阳县| 岳阳县| 边坝县| 五大连池市| 会宁县| 平阴县| 吉安市| 都匀市| 白银市| 成都市| 云浮市| 尉氏县| 长治市| 资兴市| 千阳县| 阿合奇县| 奉化市| 巨鹿县|