如何更改C#中的文本框中的字体颜色? [英] How to change the font color in the textbox in C#?

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

问题描述

如果我想将一个文本文件上传到文本框,并想突出显示
某些字体的字体颜色改变,我怎么办,没有
绘制文本?

If I want to upload a text file into the textbox and want to highlight certain words with a font color change, how can I do that without drawing the text?

谢谢。

推荐答案

假设WinForms, ForeColor 属性:

Assuming WinForms, the ForeColor property:

TextBox.ForeColor = Color.Red;

对于您希望完成的操作, RichTextBox 控制将执行此操作。

As for what you wish to accomplish, the RichTextBox control will do it.

这篇关于如何更改C#中的文本框中的字体颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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