diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 0d169fa..fb03014 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -502,19 +502,28 @@ namespace formula_manage } - private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) + private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件 { double ang; + double conc; System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox; if (!double.TryParse(curTextBox.Text, out ang) && curTextBox.Text != "") { - System.Windows.MessageBox.Show("数值错误,重新输入"); + System.Windows.MessageBox.Show("错误,重新输入"); curTextBox.Text = ""; } else { + conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常 + if (conc > 100) + { + System.Windows.MessageBox.Show("比例错误"); + curTextBox.Text = ""; + return; + } + if (e.Key == Key.Enter) { PressKey.PressKeys(Keys.Left, false); @@ -529,7 +538,6 @@ namespace formula_manage row["UNIT"] = "g"; // row["STEP"] = Procedures_P.Text; RRODUCTdataTable.Rows.Add(row); - } DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid }