Пример #1
0
 protected void UpdateText(object sender, CharacterEventArgs e)
 {
     if (_hasFocus)
     {
         if (e.Character == (char)Keys.Back)
         {
             if (Text.Length > 0)
             {
                 Text = Text.Remove(Text.Length - 1);
             }
         }
         else if (Text.Length < _maxTextLength)
         {
             Text += e.Character;
         }
     }
 }
Пример #2
0
        protected void UpdateText(object sender, CharacterEventArgs e)
        {
            if (HasFocus)
            {
                if (e.Character == (char)Keys.Back)
                {
                    if (trueText.Length > 0)
                    {
                        trueText = trueText.Remove(trueText.Length - 1);
                    }
                }
                else if (trueText.Length < MaxTextLength)
                {
                    trueText += e.Character;
                }
            }

            Text = "";
            for (int i = 0; i < trueText.Length; i++)
            {
                Text += '*';
            }
        }