fontDialog和richTextBox问题 [英] fontDialog and richTextBox problem
本文介绍了fontDialog和richTextBox问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个fontDialog,按钮和richTextBox.当我单击按钮时,将显示fontDialog.选择字体和样式后,
它会更改所有文本.但我想更改选定的文本或更改光标所在的位置.
I have a fontDialog, button and richTextBox. when I click button, fontDialog shows. after i choose font and style,
it changes all the text. but i wanna change selected text or change from where the cursor is.
Any Idea?
推荐答案
如果已经选择了文本,则只需更改SelectionFont
.
如果要从光标到结尾的位置更改,请先设置SelectionLength = TextLength - SelectionStart
,然后再更改SelectionFont
.
if you already have text selected, then just change theSelectionFont
.
If you want to change from where the cursor is to the end, then set theSelectionLength = TextLength - SelectionStart
and then change theSelectionFont
.
请参阅RichTextBox
的文档在 MSDN [
Take a look at the documentation for theRichTextBox
on MSDN[^].
About two thirds of the way down that list you should see a link to what you want.
这篇关于fontDialog和richTextBox问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文