本文整理匯總了C#中System.Windows.Forms.TextBoxBase.Select方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBoxBase.Select方法的具體用法?C# TextBoxBase.Select怎麽用?C# TextBoxBase.Select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.TextBoxBase
的用法示例。
在下文中一共展示了TextBoxBase.Select方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Find
internal static void Find(TextBoxBase textBox, string findString, bool caseSensitive, bool upwards)
{
var comparison = caseSensitive
? StringComparison.CurrentCulture
: StringComparison.CurrentCultureIgnoreCase;
var text = textBox.Text;
if (text.IndexOf(findString, comparison) == -1)
{
ShowFormattedMessageBox("Cannot find \"{0}\".", findString);
return;
}
var foundIndex = Find(text, textBox.SelectionStart, textBox.SelectionLength, findString, comparison, upwards);
if (foundIndex == -1)
{
ShowFormattedMessageBox("No further occurences of \"{0}\" have been found.", findString);
return;
}
textBox.Select(foundIndex, findString.Length);
textBox.ScrollToCaret();
}
示例2: scrollToEnd
public static void scrollToEnd(TextBoxBase txb)
{
txb.Focus();
txb.Select(txb.TextLength, 0);
}
示例3: UnselectText
/// <summary>
/// Unselect text in textbox
/// </summary>
/// <param name="control">the text box control</param>
public static void UnselectText(TextBoxBase control)
{
if (control.InvokeRequired)
{
control.Invoke(new unselectText(UnselectText), control);
}
else
{
control.SelectionLength = 0;
if (!String.IsNullOrEmpty(control.Text))
{
control.Select(control.Text.Length, 0);
}
}
}