コード例 #1
0
 private void txtQ2_KeyUp(object sender, KeyEventArgs e)
 {
     if (!string.IsNullOrEmpty(txtQ2.Text))
     {
         if (!double.TryParse(txtQ2.Text, out age))
         {
             var msgBox = new CustomMessageBox("请输入正确的数字!");
             msgBox.ShowDialog();
             txtQ2.Text = string.Empty;
             txtQ2.Focus();
             CustomNumKeyboard.GetInstance(sender).CloseKeyboard();
         }
     }
 }
コード例 #2
0
 //数字键盘
 private void txtQ2_Click(object sender, EventArgs e)
 {
     ProcessManager.KillProcessByName("TabTip");
     CustomNumKeyboard.GetInstance(sender).ShowDialog();
 }
コード例 #3
0
ファイル: QuestionOne.cs プロジェクト: hszc/unity3d_test
 private void txtAge_KeyUp(object sender, KeyEventArgs e)
 {
     if (!string.IsNullOrEmpty(txtAge.Text))
     {
         var result = double.TryParse(txtAge.Text, out age);
         if (!result)
         {
             var msgBox = new CustomMessageBox("请输入正确的数字!");
             msgBox.ShowDialog();
             txtAge.Text = string.Empty;
             txtAge.Focus();
             CustomNumKeyboard.GetInstance(sender).CloseKeyboard();
             return;
         }
         if (age < 0 || age > 150)
         {
             var msgBox = new CustomMessageBox("请输入合理的年龄范围!");
             msgBox.ShowDialog();
             txtAge.Text = string.Empty;
             txtAge.Focus();
             CustomNumKeyboard.GetInstance(sender).CloseKeyboard();
             return;
         }
         if (age <= 24)
         {
             rdoQ1Answer1.Checked = true;
         }
         if (age >= 25 && age <= 34)
         {
             rdoQ1Answer2.Checked = true;
         }
         if (age >= 35 && age <= 39)
         {
             rdoQ1Answer3.Checked = true;
         }
         if (age >= 40 && age <= 44)
         {
             rdoQ1Answer4.Checked = true;
         }
         if (age >= 45 && age <= 49)
         {
             rdoQ1Answer5.Checked = true;
         }
         if (age >= 50 && age <= 54)
         {
             rdoQ1Answer6.Checked = true;
         }
         if (age >= 55 && age <= 59)
         {
             rdoQ1Answer7.Checked = true;
         }
         if (age >= 60 && age <= 64)
         {
             rdoQ1Answer8.Checked = true;
         }
         if (age >= 65)
         {
             rdoQ1Answer9.Checked = true;
         }
     }
     else
     {
         rdoQ1Answer1.Checked = false;
         rdoQ1Answer2.Checked = false;
         rdoQ1Answer3.Checked = false;
         rdoQ1Answer4.Checked = false;
         rdoQ1Answer5.Checked = false;
         rdoQ1Answer6.Checked = false;
         rdoQ1Answer7.Checked = false;
         rdoQ1Answer8.Checked = false;
     }
 }
コード例 #4
0
        private void txtSBP_KeyUp(object sender, KeyEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtSBP.Text))
            {
                var isNum = double.TryParse(txtSBP.Text, out result);
                if (!isNum)
                {
                    var msgBox = new CustomMessageBox("请输入正确的数字!");
                    msgBox.ShowDialog();
                    txtSBP.Text = string.Empty;
                    txtSBP.Focus();
                    CustomNumKeyboard.GetInstance(sender).CloseKeyboard();
                    return;
                }

                result = (int)result;

                if (result < 90)
                {
                    rdoQ1Answer1.Checked = true;
                }
                if (result >= 90 && result <= 109)
                {
                    rdoQ1Answer2.Checked = true;
                }
                if (result >= 110 && result <= 119)
                {
                    rdoQ1Answer3.Checked = true;
                }
                if (result >= 120 && result <= 129)
                {
                    rdoQ1Answer4.Checked = true;
                }
                if (result >= 130 && result <= 139)
                {
                    rdoQ1Answer5.Checked = true;
                }
                if (result >= 140 && result <= 149)
                {
                    rdoQ1Answer6.Checked = true;
                }
                if (result >= 150 && result <= 159)
                {
                    rdoQ1Answer7.Checked = true;
                }
                if (result >= 160)
                {
                    rdoQ1Answer8.Checked = true;
                }
            }
            else
            {
                rdoQ1Answer1.Checked = false;
                rdoQ1Answer2.Checked = false;
                rdoQ1Answer3.Checked = false;
                rdoQ1Answer4.Checked = false;
                rdoQ1Answer5.Checked = false;
                rdoQ1Answer6.Checked = false;
                rdoQ1Answer7.Checked = false;
                rdoQ1Answer8.Checked = false;
            }
        }
コード例 #5
0
ファイル: QuestionTwo.cs プロジェクト: hszc/unity3d_test
        private void txtWaistSize_KeyUp(object sender, KeyEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtWaistSize.Text))
            {
                bool result = double.TryParse(txtWaistSize.Text, out waistSize);
                if (!result)
                {
                    var msgBox = new CustomMessageBox("请填写正确的数字!");
                    msgBox.ShowDialog();
                    txtWaistSize.Text = string.Empty;
                    txtWaistSize.Focus();
                    CustomNumKeyboard.GetInstance(sender).CloseKeyboard();
                    return;
                }

                if (rdoQ2Answer7.Visible == true)
                {
                    if (waistSize < 70)
                    {
                        rdoQ2Answer7.Checked = true;
                    }
                    if (waistSize >= 70 && waistSize <= 74.9)
                    {
                        rdoQ2Answer8.Checked = true;
                    }
                    if (waistSize >= 75 && waistSize <= 79.9)
                    {
                        rdoQ2Answer9.Checked = true;
                    }
                    if (waistSize >= 80 && waistSize <= 84.9)
                    {
                        rdoQ2Answer10.Checked = true;
                    }
                    if (waistSize >= 85 && waistSize <= 89.9)
                    {
                        rdoQ2Answer11.Checked = true;
                    }
                    if (waistSize >= 90)
                    {
                        rdoQ2Answer12.Checked = true;
                    }
                }
                if (rdoQ2Answer1.Visible == true)
                {
                    if (waistSize < 75)
                    {
                        rdoQ2Answer1.Checked = true;
                    }
                    if (waistSize >= 75 && waistSize <= 79.9)
                    {
                        rdoQ2Answer2.Checked = true;
                    }
                    if (waistSize >= 80 && waistSize <= 84.9)
                    {
                        rdoQ2Answer3.Checked = true;
                    }
                    if (waistSize >= 85 && waistSize <= 89.9)
                    {
                        rdoQ2Answer4.Checked = true;
                    }
                    if (waistSize >= 90 && waistSize <= 94.9)
                    {
                        rdoQ2Answer5.Checked = true;
                    }
                    if (waistSize >= 95)
                    {
                        rdoQ2Answer6.Checked = true;
                    }
                }
            }
            else
            {
                rdoQ2Answer7.Checked  = false;
                rdoQ2Answer8.Checked  = false;
                rdoQ2Answer9.Checked  = false;
                rdoQ2Answer10.Checked = false;
                rdoQ2Answer11.Checked = false;
                rdoQ2Answer12.Checked = false;
                rdoQ2Answer1.Checked  = false;
                rdoQ2Answer2.Checked  = false;
                rdoQ2Answer3.Checked  = false;
                rdoQ2Answer4.Checked  = false;
                rdoQ2Answer5.Checked  = false;
                rdoQ2Answer6.Checked  = false;
            }
        }