using ButcherManageClient; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ButcherOrder { public partial class ButcherOrderForm : Form, IAfterLogin { public ButcherOrderForm() { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; AddKeyPad(); } #region IAfterLogin public string RoleName { get { return "测试"; } } public Form Generate() { return this; } # endregion private void AddKeyPad() { for (var i = 1; i < 10; i++) { var btn = new Button() { Name = "_" + i, Text = i.ToString(), Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; btn.Click += (sender, e) => { numberInput.Text += btn.Text; }; keyPanel.Controls.Add(btn); } var zero = new Button() { Name = "_0", Text = "0", Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; zero.Click += (sender, e) => { if (!string.IsNullOrEmpty(numberInput.Text)) numberInput.Text += "0"; }; keyPanel.Controls.Add(zero); var back = new Button() { Name = "_back", Text = "←", Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; back.Click += (sender, e) => { if (!string.IsNullOrEmpty(numberInput.Text)) numberInput.Text = numberInput.Text.Substring(0, numberInput.Text.Length - 1); }; keyPanel.Controls.Add(back); var clear = new Button() { Name = "_clear", Text = "清空", Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; clear.Click += (sender, e) => { numberInput.Text = null; }; keyPanel.Controls.Add(clear); } private void existBtn_Click(object sender, EventArgs e) { this.Close(); } private void syncBtn_Click(object sender, EventArgs e) { } private void okBtn_Click(object sender, EventArgs e) { } private void updateBtn_Click(object sender, EventArgs e) { } } }