本文整理汇总了C#中System.Windows.Forms.TextBoxBase.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# TextBoxBase.Focus方法的具体用法?C# TextBoxBase.Focus怎么用?C# TextBoxBase.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TextBoxBase
的用法示例。
在下文中一共展示了TextBoxBase.Focus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseInputH
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;
}
示例2: ParseInputD
public static bool ParseInputD(TextBoxBase control, out ulong value)
{
if (!ulong.TryParse(control.Text, out value))
{
control.Focus();
control.SelectAll();
return false;
}
return true;
}
示例3: MostrarMensagem
/// <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
{ }
}
示例4: DoSearch
}//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
示例5: scrollToEnd
public static void scrollToEnd(TextBoxBase txb)
{
txb.Focus();
txb.Select(txb.TextLength, 0);
}
示例6: ParseInputD
private static bool ParseInputD(TextBoxBase control, out ushort value)
{
if (!ushort.TryParse(control.Text, out value))
{
control.Focus();
control.SelectAll();
return false;
}
return true;
}
示例7: SetCaretAt
private static void SetCaretAt(TextBoxBase textBox, int position)
{
textBox.Focus();
textBox.SelectionStart = position;
textBox.SelectionLength = 0;
textBox.ScrollToCaret();
}