本文整理汇总了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);
}
}
}