From 6add358cab3b4baec98912a7319922dc69173dbb Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Sat, 10 Jul 2021 09:45:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8D=95No.158193=E2=80=9C?= =?UTF-8?q?=E5=88=86=E5=89=B2=E8=BD=A6=E9=97=B4=E7=A7=B0=E9=87=8D=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E2=80=9D=E5=AE=A2=E6=88=B7=E7=AB=AF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ButcherFactory.BO/Bill/SegmentProduction.cs | 2 +- .../GoodsNumberInputDialog.Designer.cs | 251 ++++++++++++++++-- .../GoodsNumberInputDialog.cs | 63 +++-- 3 files changed, 271 insertions(+), 45 deletions(-) diff --git a/ButcherFactory.BO/Bill/SegmentProduction.cs b/ButcherFactory.BO/Bill/SegmentProduction.cs index e39daf9..ec95d17 100644 --- a/ButcherFactory.BO/Bill/SegmentProduction.cs +++ b/ButcherFactory.BO/Bill/SegmentProduction.cs @@ -131,7 +131,7 @@ namespace ButcherFactory.BO public string Goods_Code { get; set; } - public int Number { get; set; } + public decimal Number { get; set; } private DateTime mTime = DateTime.Now; [DbColumn(DbType = SqlDbType.DateTime)] diff --git a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs index a408ca5..cad6e91 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs @@ -29,11 +29,26 @@ namespace ButcherFactory.SegmentProductionAuto_ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.okBtn = new ButcherFactory.Controls.ColorButton(); this.cancelBtn = new ButcherFactory.Controls.ColorButton(); this.goodsNameLbl = new System.Windows.Forms.Label(); this.identityRemark = new System.Windows.Forms.Label(); this.numberBox = new System.Windows.Forms.TextBox(); + this.roundPanel1 = new ButcherFactory.Controls.RoundPanel(this.components); + this.colorButton1 = new ButcherFactory.Controls.ColorButton(); + this.colorButton2 = new ButcherFactory.Controls.ColorButton(); + this.colorButton3 = new ButcherFactory.Controls.ColorButton(); + this.colorButton4 = new ButcherFactory.Controls.ColorButton(); + this.colorButton5 = new ButcherFactory.Controls.ColorButton(); + this.colorButton6 = new ButcherFactory.Controls.ColorButton(); + this.colorButton7 = new ButcherFactory.Controls.ColorButton(); + this.colorButton8 = new ButcherFactory.Controls.ColorButton(); + this.colorButton9 = new ButcherFactory.Controls.ColorButton(); + this.colorButton10 = new ButcherFactory.Controls.ColorButton(); + this.colorButton11 = new ButcherFactory.Controls.ColorButton(); + this.colorButton12 = new ButcherFactory.Controls.ColorButton(); + this.roundPanel1.SuspendLayout(); this.SuspendLayout(); // // okBtn @@ -41,11 +56,10 @@ namespace ButcherFactory.SegmentProductionAuto_ this.okBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); this.okBtn.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.okBtn.ForeColor = System.Drawing.Color.White; - this.okBtn.Location = new System.Drawing.Point(132, 388); - this.okBtn.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.okBtn.Location = new System.Drawing.Point(67, 536); this.okBtn.Name = "okBtn"; this.okBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); - this.okBtn.Size = new System.Drawing.Size(280, 112); + this.okBtn.Size = new System.Drawing.Size(140, 56); this.okBtn.TabIndex = 1; this.okBtn.Text = "确定"; this.okBtn.UseVisualStyleBackColor = false; @@ -56,11 +70,10 @@ namespace ButcherFactory.SegmentProductionAuto_ this.cancelBtn.BackColor = System.Drawing.Color.Red; this.cancelBtn.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cancelBtn.ForeColor = System.Drawing.Color.White; - this.cancelBtn.Location = new System.Drawing.Point(596, 388); - this.cancelBtn.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.cancelBtn.Location = new System.Drawing.Point(299, 536); this.cancelBtn.Name = "cancelBtn"; this.cancelBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); - this.cancelBtn.Size = new System.Drawing.Size(274, 112); + this.cancelBtn.Size = new System.Drawing.Size(137, 56); this.cancelBtn.TabIndex = 2; this.cancelBtn.Text = "取消"; this.cancelBtn.UseVisualStyleBackColor = false; @@ -71,10 +84,9 @@ namespace ButcherFactory.SegmentProductionAuto_ this.goodsNameLbl.AutoSize = true; this.goodsNameLbl.Font = new System.Drawing.Font("微软雅黑", 17F, System.Drawing.FontStyle.Bold); this.goodsNameLbl.ForeColor = System.Drawing.Color.DeepSkyBlue; - this.goodsNameLbl.Location = new System.Drawing.Point(58, 44); - this.goodsNameLbl.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.goodsNameLbl.Location = new System.Drawing.Point(29, 22); this.goodsNameLbl.Name = "goodsNameLbl"; - this.goodsNameLbl.Size = new System.Drawing.Size(163, 60); + this.goodsNameLbl.Size = new System.Drawing.Size(83, 31); this.goodsNameLbl.TabIndex = 5; this.goodsNameLbl.Text = "冻带皮"; // @@ -83,38 +95,224 @@ namespace ButcherFactory.SegmentProductionAuto_ this.identityRemark.AutoSize = true; this.identityRemark.Font = new System.Drawing.Font("微软雅黑", 14F); this.identityRemark.ForeColor = System.Drawing.Color.Black; - this.identityRemark.Location = new System.Drawing.Point(210, 202); - this.identityRemark.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.identityRemark.Location = new System.Drawing.Point(105, 72); this.identityRemark.Name = "identityRemark"; - this.identityRemark.Size = new System.Drawing.Size(98, 50); + this.identityRemark.Size = new System.Drawing.Size(50, 25); this.identityRemark.TabIndex = 6; this.identityRemark.Text = "个数"; // // numberBox // - this.numberBox.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.numberBox.Location = new System.Drawing.Point(400, 198); - this.numberBox.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.numberBox.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.numberBox.Location = new System.Drawing.Point(193, 70); this.numberBox.Name = "numberBox"; - this.numberBox.Size = new System.Drawing.Size(384, 51); + this.numberBox.Size = new System.Drawing.Size(194, 35); this.numberBox.TabIndex = 7; - this.numberBox.Click += new System.EventHandler(this.numberBox_Click); + // + // roundPanel1 + // + this.roundPanel1.Controls.Add(this.colorButton10); + this.roundPanel1.Controls.Add(this.colorButton11); + this.roundPanel1.Controls.Add(this.colorButton12); + this.roundPanel1.Controls.Add(this.colorButton7); + this.roundPanel1.Controls.Add(this.colorButton8); + this.roundPanel1.Controls.Add(this.colorButton9); + this.roundPanel1.Controls.Add(this.colorButton4); + this.roundPanel1.Controls.Add(this.colorButton5); + this.roundPanel1.Controls.Add(this.colorButton6); + this.roundPanel1.Controls.Add(this.colorButton3); + this.roundPanel1.Controls.Add(this.colorButton2); + this.roundPanel1.Controls.Add(this.colorButton1); + this.roundPanel1.Location = new System.Drawing.Point(35, 139); + this.roundPanel1.Margin = new System.Windows.Forms.Padding(0); + this.roundPanel1.Name = "roundPanel1"; + this.roundPanel1.Size = new System.Drawing.Size(442, 370); + this.roundPanel1.TabIndex = 8; + // + // colorButton1 + // + this.colorButton1.BackColor = System.Drawing.Color.Black; + this.colorButton1.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.colorButton1.ForeColor = System.Drawing.Color.White; + this.colorButton1.Location = new System.Drawing.Point(28, 22); + this.colorButton1.Name = "colorButton1"; + this.colorButton1.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton1.Size = new System.Drawing.Size(99, 60); + this.colorButton1.TabIndex = 0; + this.colorButton1.Text = "7"; + this.colorButton1.UseVisualStyleBackColor = false; + this.colorButton1.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton2 + // + this.colorButton2.BackColor = System.Drawing.Color.Black; + this.colorButton2.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton2.ForeColor = System.Drawing.Color.White; + this.colorButton2.Location = new System.Drawing.Point(174, 22); + this.colorButton2.Name = "colorButton2"; + this.colorButton2.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton2.Size = new System.Drawing.Size(99, 60); + this.colorButton2.TabIndex = 1; + this.colorButton2.Text = "8"; + this.colorButton2.UseVisualStyleBackColor = false; + this.colorButton2.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton3 + // + this.colorButton3.BackColor = System.Drawing.Color.Black; + this.colorButton3.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton3.ForeColor = System.Drawing.Color.White; + this.colorButton3.Location = new System.Drawing.Point(322, 22); + this.colorButton3.Name = "colorButton3"; + this.colorButton3.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton3.Size = new System.Drawing.Size(99, 60); + this.colorButton3.TabIndex = 2; + this.colorButton3.Text = "9"; + this.colorButton3.UseVisualStyleBackColor = false; + this.colorButton3.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton4 + // + this.colorButton4.BackColor = System.Drawing.Color.Black; + this.colorButton4.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton4.ForeColor = System.Drawing.Color.White; + this.colorButton4.Location = new System.Drawing.Point(322, 111); + this.colorButton4.Name = "colorButton4"; + this.colorButton4.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton4.Size = new System.Drawing.Size(99, 60); + this.colorButton4.TabIndex = 5; + this.colorButton4.Text = "6"; + this.colorButton4.UseVisualStyleBackColor = false; + this.colorButton4.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton5 + // + this.colorButton5.BackColor = System.Drawing.Color.Black; + this.colorButton5.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton5.ForeColor = System.Drawing.Color.White; + this.colorButton5.Location = new System.Drawing.Point(174, 111); + this.colorButton5.Name = "colorButton5"; + this.colorButton5.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton5.Size = new System.Drawing.Size(99, 60); + this.colorButton5.TabIndex = 4; + this.colorButton5.Text = "5"; + this.colorButton5.UseVisualStyleBackColor = false; + this.colorButton5.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton6 + // + this.colorButton6.BackColor = System.Drawing.Color.Black; + this.colorButton6.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton6.ForeColor = System.Drawing.Color.White; + this.colorButton6.Location = new System.Drawing.Point(28, 111); + this.colorButton6.Name = "colorButton6"; + this.colorButton6.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton6.Size = new System.Drawing.Size(99, 60); + this.colorButton6.TabIndex = 3; + this.colorButton6.Text = "4"; + this.colorButton6.UseVisualStyleBackColor = false; + this.colorButton6.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton7 + // + this.colorButton7.BackColor = System.Drawing.Color.Black; + this.colorButton7.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton7.ForeColor = System.Drawing.Color.White; + this.colorButton7.Location = new System.Drawing.Point(322, 200); + this.colorButton7.Name = "colorButton7"; + this.colorButton7.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton7.Size = new System.Drawing.Size(99, 60); + this.colorButton7.TabIndex = 8; + this.colorButton7.Text = "3"; + this.colorButton7.UseVisualStyleBackColor = false; + this.colorButton7.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton8 + // + this.colorButton8.BackColor = System.Drawing.Color.Black; + this.colorButton8.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton8.ForeColor = System.Drawing.Color.White; + this.colorButton8.Location = new System.Drawing.Point(174, 200); + this.colorButton8.Name = "colorButton8"; + this.colorButton8.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton8.Size = new System.Drawing.Size(99, 60); + this.colorButton8.TabIndex = 7; + this.colorButton8.Text = "2"; + this.colorButton8.UseVisualStyleBackColor = false; + this.colorButton8.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton9 + // + this.colorButton9.BackColor = System.Drawing.Color.Black; + this.colorButton9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton9.ForeColor = System.Drawing.Color.White; + this.colorButton9.Location = new System.Drawing.Point(28, 200); + this.colorButton9.Name = "colorButton9"; + this.colorButton9.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton9.Size = new System.Drawing.Size(99, 60); + this.colorButton9.TabIndex = 6; + this.colorButton9.Text = "1"; + this.colorButton9.UseVisualStyleBackColor = false; + this.colorButton9.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton10 + // + this.colorButton10.BackColor = System.Drawing.Color.Black; + this.colorButton10.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton10.ForeColor = System.Drawing.Color.White; + this.colorButton10.Location = new System.Drawing.Point(322, 288); + this.colorButton10.Name = "colorButton10"; + this.colorButton10.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton10.Size = new System.Drawing.Size(99, 60); + this.colorButton10.TabIndex = 11; + this.colorButton10.Text = "退格"; + this.colorButton10.UseVisualStyleBackColor = false; + this.colorButton10.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton11 + // + this.colorButton11.BackColor = System.Drawing.Color.Black; + this.colorButton11.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton11.ForeColor = System.Drawing.Color.White; + this.colorButton11.Location = new System.Drawing.Point(174, 288); + this.colorButton11.Name = "colorButton11"; + this.colorButton11.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton11.Size = new System.Drawing.Size(99, 60); + this.colorButton11.TabIndex = 10; + this.colorButton11.Text = "."; + this.colorButton11.UseVisualStyleBackColor = false; + this.colorButton11.Click += new System.EventHandler(this.NumBtnClick); + // + // colorButton12 + // + this.colorButton12.BackColor = System.Drawing.Color.Black; + this.colorButton12.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.colorButton12.ForeColor = System.Drawing.Color.White; + this.colorButton12.Location = new System.Drawing.Point(28, 288); + this.colorButton12.Name = "colorButton12"; + this.colorButton12.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.colorButton12.Size = new System.Drawing.Size(99, 60); + this.colorButton12.TabIndex = 9; + this.colorButton12.Text = "0"; + this.colorButton12.UseVisualStyleBackColor = false; + this.colorButton12.Click += new System.EventHandler(this.NumBtnClick); // // GoodsNumberInputDialog // - this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1064, 580); + this.ClientSize = new System.Drawing.Size(532, 627); + this.Controls.Add(this.roundPanel1); this.Controls.Add(this.numberBox); this.Controls.Add(this.identityRemark); this.Controls.Add(this.goodsNameLbl); this.Controls.Add(this.cancelBtn); this.Controls.Add(this.okBtn); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); this.Name = "GoodsNumberInputDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "产品件数录入"; + this.roundPanel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -127,5 +325,18 @@ namespace ButcherFactory.SegmentProductionAuto_ private System.Windows.Forms.Label goodsNameLbl; private System.Windows.Forms.Label identityRemark; private System.Windows.Forms.TextBox numberBox; + private Controls.RoundPanel roundPanel1; + private Controls.ColorButton colorButton10; + private Controls.ColorButton colorButton11; + private Controls.ColorButton colorButton12; + private Controls.ColorButton colorButton7; + private Controls.ColorButton colorButton8; + private Controls.ColorButton colorButton9; + private Controls.ColorButton colorButton4; + private Controls.ColorButton colorButton5; + private Controls.ColorButton colorButton6; + private Controls.ColorButton colorButton3; + private Controls.ColorButton colorButton2; + private Controls.ColorButton colorButton1; } } \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs index f923403..479eb4f 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs @@ -1,5 +1,6 @@ using ButcherFactory.BO; using ButcherFactory.BO.LocalBL; +using ButcherFactory.Controls; using System; using System.Collections.Generic; using System.ComponentModel; @@ -16,7 +17,7 @@ namespace ButcherFactory.SegmentProductionAuto_ public partial class GoodsNumberInputDialog : Form { ClientGoodsSet_Detail goodsInfo; - int number = 0; + decimal number = 0; public GoodsNumberInputDialog(ClientGoodsSet_Detail mGoods) { goodsInfo = mGoods; @@ -24,31 +25,9 @@ namespace ButcherFactory.SegmentProductionAuto_ goodsNameLbl.Text = goodsInfo.Goods_Name; } - private void numberBox_Click(object sender, EventArgs e) - { - var keyBoard = new NumberPad(); - if (keyBoard.ShowDialog() == true) - { - if (string.IsNullOrEmpty(keyBoard.Result)) - numberBox.Text = null; - else - { - int pics; - if (int.TryParse(keyBoard.Result, out pics)) - { - numberBox.Text = pics.ToString(); - number = pics; - } - else - { - numberBox.Text = null; - } - } - } - } - private void okBtn_Click(object sender, EventArgs e) { + ParseNumber(); if (number == 0) throw new Exception("请输入数量"); var log = new SegmentGoodsProductNumLog(); @@ -64,5 +43,41 @@ namespace ButcherFactory.SegmentProductionAuto_ { DialogResult = DialogResult.Cancel; } + + private void NumBtnClick(object sender, EventArgs e) + { + var btn = sender as ColorButton; + switch (btn.Text) + { + case "退格": + if (this.numberBox.Text != null && this.numberBox.Text.Length > 0) + this.numberBox.Text = this.numberBox.Text.Substring(0, this.numberBox.Text.Length - 1); + break; + case ".": + if (this.numberBox.Text.Contains(".")) + return; + if (string.IsNullOrEmpty(this.numberBox.Text)) + numberBox.Text = "0."; + else + numberBox.Text += btn.Text; + break; + case "0": + if (this.numberBox.Text != "0") + numberBox.Text += btn.Text; + break; + default: + if (this.numberBox.Text == "0") + this.numberBox.Text = btn.Text; + else + numberBox.Text += btn.Text; + break; + } + } + + void ParseNumber() + { + if (!decimal.TryParse(numberBox.Text, out number)) + throw new Exception("输入有误!"); + } } }