Пример #1
0
 void OnCharEnter(object sender, CharacterEventArgs e)
 {
     if (e.Character == 13)
     {
         isTyping = false;
         EventInput.CharEntered -= OnCharEnter;
         menu.TextBoxDone(this);
     }
     else if (e.Character > 31 && e.Character < 255)
     {
         if (text.Length < maxl)
         {
             text.Append(e.Character);
         }
     }
     else if (e.Character == 8)
     {//delete char
         if (text.Length != 0)
         {
             text.Length--;
         }
     }
 }
Пример #2
0
 public void OnCharEnter(object sender, CharacterEventArgs e)
 {
     if (e.Character == 13)
     {
         isTyping = false;
         EventInput.CharEntered -= OnCharEnter;
         int val;
         if (text.Length == 0)
         {
             val = 0;
         }
         else
         {
             val = Value;
         }
         if (val < min)
         {
             val = min;
         }
         else if (val > max)
         {
             val = max;
         }
         text.Clear();
         text.Append(val.ToString());
         menu.NumberTextBoxDone(this);
     }
     else if (e.Character >= '0' && e.Character <= '9')
     {
         if (text.Length < text.Capacity)
         {
             if (text.Length == 1 && text[0] == '0')
             {
                 text.Clear();
             }
             text.Append(e.Character);
             int val;
             if (text.Length == 0)
             {
                 val = 0;
             }
             else
             {
                 val = Value;
             }
             if (val > max)
             {
                 val = max;
             }
             text.Clear();
             text.Append(val.ToString());
             menu.NumberTextBoxChanged(this);
         }
     }
     else if (e.Character == 8)
     {//delete char
         text.Length--;
         if (text.Length == 0)
         {
             text.Append("0");
         }
         menu.NumberTextBoxChanged(this);
     }
 }