我正在制作一个文字处理器,并希望用户能够通过点击/按住/拖动来仅将您在 Windows Phone 上选择的文本加粗。我知道如何使用 Filebox.SelectedText 检测用户选择了哪些文本(filebox 是文本框的名称),但不知道从那里去哪里 - 我如何获取选定的文本并只选择该文本文字加粗?
注意:我使用的是 ComponentOne 的富文本框控件。
我正在制作一个文字处理器,并希望用户能够通过点击/按住/拖动来仅将您在 Windows Phone 上选择的文本加粗。我知道如何使用 Filebox.SelectedText 检测用户选择了哪些文本(filebox 是文本框的名称),但不知道从那里去哪里 - 我如何获取选定的文本并只选择该文本文字加粗?
注意:我使用的是 ComponentOne 的富文本框控件。
您可以使用该RichTextBox.Selection
物业。
例如:
private void ModifySelectedText()
{
// Determine if text is selected in the control.
if (richTextBox1.SelectionLength > 0)
{
// Set the color of the selected text in the control.
richTextBox1.SelectionColor = Color.Red;
// Set the font of the selected text to bold and underlined.
richTextBox1.SelectionFont = new Font("Arial",10,FontStyle.Bold | FontStyle.Underline);
// Protect the selected text from modification.
richTextBox1.SelectionProtected = true;
}
}