public void AddPanel(View_FormulaInfoModel model) { Panel currentPanel = new Panel(); currentPanel.Dock = DockStyle.Top; currentPanel.Height = (int)this.Font.GetHeight() + 20; currentPanel.BackColor = Color.Transparent; currentPanel.BorderStyle = LabelBorderStyle; currentPanel.Tag = model.BarCode; this.Controls.Add(currentPanel); currentPanel.BringToFront(); if (!dcPanel.ContainsKey(model.BarCode)) { dcPanel.Add(model.BarCode, currentPanel); } for (int i = 0; i < 6; i++) { Label lbl = new Label(); lbl.Width = this.Width / 7 + 1; lbl.AutoSize = false; lbl.ForeColor = this.ForeColor; switch (i) { case 0: lbl.Text = model.BarCode; break; case 1: lbl.Text = model.DeviceName; break; case 2: lbl.Text = model.Customer; break; case 3: lbl.Text = model.ProductSpecification; break; case 4: lbl.Text = model.CylinderNum.ToString(); break; case 5: lbl.Text = model.CompleteCylinderNum.ToString(); break; } lbl.TextAlign = ContentAlignment.MiddleCenter; lbl.Dock = DockStyle.Left; lbl.Font = this.Font; lbl.BorderStyle = LabelBorderStyle; currentPanel.Controls.Add(lbl); lbl.BringToFront(); } ButtonEx btn = new ButtonEx(); btn.Text = "删除"; btn.Font = this.Font; btn.Click += btn_Click; btn.Dock = DockStyle.Left; btn.Width = this.Width / 7 + 1; btn.Tag = model.BarCode; currentPanel.Controls.Add(btn); btn.BringToFront(); }
private void btn_Click(object sender, EventArgs e) { ButtonEx btn = (ButtonEx)sender; if (btn.Text == "清零") { if (_value != null) { //if (_value.Length > 1) //{ // _value = _value.Remove(_value.Length - 1); //} //else //{ _value = "0"; //} } else { _value = "0"; } } else if (btn.Text == ".") { if (string.IsNullOrEmpty(_value)) { _value = "0"; } if (!_value.Contains(".")) { _value += btn.Text; } } else { if (_value == "0") { _value = btn.Text; } else { _value += btn.Text; } } ValueChange(Value, null); }
/// <summary> /// 添加Tab按钮 /// </summary> private void AddTabButton() { // btnB this.btnB = new MyControl.ButtonEx(); this.btnB.BackColor = System.Drawing.Color.Transparent; this.btnB.ForeColor = System.Drawing.Color.White; this.btnB.BaseColor = System.Drawing.Color.Black; this.btnB.Dock = System.Windows.Forms.DockStyle.Left; this.btnB.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnB.Location = new System.Drawing.Point(150, 0); this.btnB.Name = "btnB"; this.btnB.Radius = 10; this.btnB.RoundStyle = MyControl.RoundStyle.Top; this.btnB.Size = new System.Drawing.Size(150, 45); this.btnB.TabIndex = 1; this.btnB.Text = "水洗配送"; this.btnB.UseVisualStyleBackColor = false; this.btnB.Click += new System.EventHandler(this.btnB_Click); this.panelButton.Controls.Add(this.btnB); // // btnA this.btnA = new MyControl.ButtonEx(); this.btnA.BackColor = System.Drawing.Color.Transparent; this.btnA.ForeColor = System.Drawing.Color.Black; this.btnA.Dock = System.Windows.Forms.DockStyle.Left; this.btnA.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnA.Location = new System.Drawing.Point(0, 0); this.btnA.Name = "btnA"; this.btnA.Radius = 10; this.btnA.RoundStyle = MyControl.RoundStyle.Top; this.btnA.Size = new System.Drawing.Size(150, 45); this.btnA.TabIndex = 0; this.btnA.Text = "定型配送"; this.btnA.UseVisualStyleBackColor = false; this.btnA.Click += new System.EventHandler(this.BtnA_Click); this.panelButton.Controls.Add(this.btnA); }
private void AddBtn() { for (int i = 0; i < 10; i++) { ButtonEx btn = new ButtonEx(); btn.Text = i.ToString(); btn.Font = this.Font; btn.Radius = 15; btn.Width = 10; btn.Dock = DockStyle.Left; btn.Click += btn_Click; this.Controls.Add(btn); btn.BringToFront(); } ButtonEx btnDot = new ButtonEx(); btnDot.Text = "."; btnDot.Font = this.Font; btnDot.Radius = 15; btnDot.Width = 10; btnDot.Dock = DockStyle.Left; btnDot.Click += btn_Click; this.Controls.Add(btnDot); btnDot.BringToFront(); ButtonEx btnDel = new ButtonEx(); btnDel.Text = "清零"; btnDel.Font = this.Font; btnDel.Radius = 15; btnDel.Width = 10; btnDel.Dock = DockStyle.Left; btnDel.Click += btn_Click; this.Controls.Add(btnDel); btnDel.BringToFront(); }