private void Txt_Enter(object sender, EventArgs e)
        {
            TextBox tbx = (TextBox)sender;

            KeyBoard.KeyNum keyNum = new KeyBoard.KeyNum();
            keyNum.TxtString = tbx.Text;
            keyNum.ShowDialog();
            tbx.Text         = keyNum.TxtString;
            keyNum.TxtString = "";
        }
 private void Txt_Enter(object sender, EventArgs e)
 {
     try
     {
         TextBox         tbx    = (TextBox)sender;
         KeyBoard.KeyNum keyNum = new KeyBoard.KeyNum();
         keyNum.TxtString = tbx.Text;
         keyNum.ShowDialog();
         tbx.Text = keyNum.TxtString;
         if (tbx.Name == "TxtCurrent1" || tbx.Name == "TxtCurrent2" || tbx.Name == "TxtCurrent3" || tbx.Name == "TxtCurrent4" || tbx.Name == "TxtCurrent5" || tbx.Name == "TxtCheckValue1")
         {
             if (Convert.ToInt32(tbx.Text) > Global.currentMax)
             {
                 MessageBox.Show("设置值大于电流上限,请重新设置");
                 tbx.Text = "0";
             }
         }
         else if (tbx.Name == "TxtVoltage1" || tbx.Name == "TxtVoltage2" || tbx.Name == "TxtVoltage3" || tbx.Name == "TxtVoltage4" || tbx.Name == "TxtVoltage5" || tbx.Name == "TxtCheckValue2")
         {
             if (Convert.ToInt32(tbx.Text) > Global.voltageMax)
             {
                 MessageBox.Show("设置值大于电压上限,请重新设置");
                 tbx.Text = "0";
             }
         }
         else if (tbx.Name == "TxtResidualCurrent1" || tbx.Name == "TxtResidualCurrent2" || tbx.Name == "TxtResidualCurrent3" || tbx.Name == "TxtResidualCurrent4" || tbx.Name == "TxtResidualCurrent5" || tbx.Name == "TxtCheckValue3")
         {
             if (Convert.ToInt32(tbx.Text) > Global.residualCurrentMax)
             {
                 MessageBox.Show("设置值大于剩余电流上限,请重新设置");
                 tbx.Text = "0";
             }
         }
         keyNum.TxtString = "";
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex);
     }
 }
Example #3
0
 /// <summary>
 /// 调用键盘
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Txt_Enter(object sender, EventArgs e)
 {
     try
     {
         TextBox         tbx    = (TextBox)sender;
         KeyBoard.KeyNum keyNum = new KeyBoard.KeyNum();
         keyNum.TxtString = tbx.Text;
         keyNum.ShowDialog();
         tbx.Text = keyNum.TxtString;
         if (tbx.Name == "TxtCurrent" || tbx.Name == "TxtLowCurrent" || tbx.Name == "TxtHighCurrent")
         {
             if (Convert.ToInt32(tbx.Text) > Global.instaniousMax)
             {
                 MessageBox.Show("设置输出值大于瞬时上限,请重新设置");
                 tbx.Text = "0";
             }
         }
         keyNum.TxtString = "";
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex);
     }
 }
 private void Txt_Click(object sender, EventArgs e)
 {
     try
     {
         TextBox         tbx    = (TextBox)sender;
         KeyBoard.KeyNum keyNum = new KeyBoard.KeyNum();
         keyNum.TxtString = tbx.Text;
         keyNum.ShowDialog();
         tbx.Text = keyNum.TxtString;
         if (tbx.Name == "TxtOverVoltage")
         {
             if (Convert.ToInt32(tbx.Text) > Global.overVoltageMax)
             {
                 MessageBox.Show("设置过压值大于过压上限");
                 tbx.Text = "0";
             }
         }
         keyNum.TxtString = "";
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex);
     }
 }