如何手动更改字体和字体大小 [英] How to change font and font size manually

查看:165
本文介绍了如何手动更改字体和字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要在一种字体中显示一个单词,在下一行中显示其他字体。

在给定的示例程序中,最后设置的字体应用于整个文本



我尝试过:



It need to display one word in one font and next line other font .
In Given sample program the last set font is applied for the entire text

What I have tried:

RichTextBox.Font = new Font("Arial", 14, FontStyle.Bold);
           RichTextBox.Text = Form1.FN+" "+Form1.LN+"\n";
           RichTextBox.Font = new Font("Arial", 10);
           RichTextBox.Text +=("Mobile: " )+ Form1.M;

推荐答案

您可能需要阅读 RichTextBox控件 [ ^ ]。在那里,你会发现以选择开头的各种属性。使用SelectionStart和SelectionLength属性,您可以在其中选择文本,然后使用其他属性更改所选文本,例如SelectionFont。
You might want to read the documentation on the RichTextBox control[^]. There, you'll find various properties beginning with "Selection". Use the SelectionStart and SelectionLength properties where you can select text and then use the other properties to make changes to the selected text, such as SelectionFont.


这篇关于如何手动更改字体和字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆