首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何仅更改高亮文本的字体?

问如何仅更改高亮文本的字体?
EN

Stack Overflow用户
提问于 2013-03-11 03:41:51
回答 1查看 269关注 0票数 1

我正在制作一个文字处理器,并希望用户有能力粗体只有你在windows phone上选择的文本点击/按住/拖动。我知道如何使用Filebox.SelectedText检测用户选择的文本(filebox是文本框的名称),但不知道从哪里开始-如何获取所选文本并仅将其加粗?

注意:我使用的是ComponentOne的Rich Textbox控件。

EN

回答 1

Stack Overflow用户

发布于 2013-03-11 04:52:20

您可以使用RichTextBox.Selection属性。

例如:

代码语言:javascript
复制
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;
   }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15326661

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档