如何在不更改样式的情况下更改richtextbox字体? [英] how to change the richtextbox font with out changing the Style of it?

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

问题描述

是我编写的代码,但是没有用吗?

were is the code that i did make but it don''t work ?

RichTextBox1.SelectionFont = New System.Drawing.Font(ComboBox1.Text, ComboBox2.Text, RichTextBox1.SelectionFont.Style)

>

推荐答案

正如LanFanNinja在上述评论中所说,您正在传递String Value,而您必须传递Single.我认为您正在使用Vb.Net languge
为RichTextBox设置字体的语法如下:
Exactly as LanFanNinja said in above comment you are passing String Value where you have to pass Single.I think you are using Vb.Net languge
The syntax to Set Font for RichTextBox is as follows :
RichTextBox1.SelectionFont = New Font("Tahoma", 12, FontStyle.Bold)


您更改代码,然后尝试以下方法:


You change your code and try this :

RichTextBox1.SelectionFont = New System.Drawing.Font(ComboBox1.Text, CType(ComboBox2.Text, Single), RichTextBox1.SelectionFont.Style)


这篇关于如何在不更改样式的情况下更改richtextbox字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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