public static bool ParseInputH(TextBoxBase control, out ulong value)
 {
     if (!ulong.TryParse(control.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value))
     {
         control.Focus();
         control.SelectAll();
         return false;
     }
     return true;
 }
 public static bool ParseInputD(TextBoxBase control, out ulong value)
 {
     if (!ulong.TryParse(control.Text, out value))
     {
         control.Focus();
         control.SelectAll();
         return false;
     }
     return true;
 }
        /// <summary>
        /// Mostra mensagem.
        /// </summary>
        private static void MostrarMensagem(TextBoxBase txt, string título, string mensagem)
        {
            Balloon.NET.BalloonHelp balão = new Balloon.NET.BalloonHelp();
            balão.Caption = título;
            balão.Icon = SystemIcons.Exclamation;
            balão.CloseOnDeactivate = false;
            balão.CloseOnKeyPress = false;
            balão.Content = mensagem;

            try
            {
                balão.ShowBalloon(txt);
                txt.Focus();
            }
            catch
            { }
        }
    }//method

    private bool DoSearch(TextBoxBase textBox, string fragment, int start) {
      textBox.SelectionLength = 0;
      // Compile the regular expression.
      Regex r = new Regex(fragment, RegexOptions.IgnoreCase);
      // Match the regular expression pattern against a text string.
      Match m = r.Match(textBox.Text.Substring(start));
      if (m.Success) {
        int i = 0;
        Group g = m.Groups[i];
        CaptureCollection cc = g.Captures;
        Capture c = cc[0];
        textBox.SelectionStart = c.Index + start;
        textBox.SelectionLength = c.Length;
        textBox.Focus();
        textBox.ScrollToCaret();
        return true;
      }
      return false;
    }//method
Exemple #5
0
 public static void scrollToEnd(TextBoxBase txb)
 {
     txb.Focus();
     txb.Select(txb.TextLength, 0);
 }
 private static bool ParseInputD(TextBoxBase control, out ushort value)
 {
     if (!ushort.TryParse(control.Text, out value))
     {
         control.Focus();
         control.SelectAll();
         return false;
     }
     return true;
 }
 private static void SetCaretAt(TextBoxBase textBox, int position)
 {
     textBox.Focus();
     textBox.SelectionStart = position;
     textBox.SelectionLength = 0;
     textBox.ScrollToCaret();
 }