如何在richtextbox中将第一个数字写为粗体数字

编程入门 行业动态 更新时间:2024-10-22 23:44:49
本文介绍了如何在richtextbox中将第一个数字写为粗体数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

例如12 25 2 4 5 2 45 1 2来自上述数字,而在Richtextbox中打印我希望第一个数字12为粗体或彩色,休息数字应该打印简单 我的尝试: ****************** ********** 解决方案

询问Google。快速搜索Google会导致:

richTextBox1.Rtf = @ {\rtf1 \b 12 \b0 25 2 4 5 2 45 1 2 };

我希望它有所帮助。

试试这个。

public Form1() { InitializeComponent(); richTextBox1.SelectionFont = new 字体(richTextBox1.Font,FontStyle.Bold); } private void richTextBox1_TextChanged( object sender,EventArgs e) { int lastCharacter = richTextBox1.TextLength; if (lastCharacter > 1 ) if (richTextBox1.Lines [ 0 ] [lastCharacter - 1 ] == ' ') { richTextBox1.SelectionFont = new 字体(richTextBox1.Font,FontStyle.Regular); } }

我希望这会对你有所帮助。如果有任何疑问,请问我。 谢谢

eg 12 25 2 4 5 2 45 1 2 from the above number while printing in Richtextbox i want first number 12 as bold or maybe coloured and rest number should print in simple What I have tried: ******************************************************************

解决方案

Ask Google. A quick search on Google results in:

richTextBox1.Rtf = @"{\rtf1 \b 12 \b0 25 2 4 5 2 45 1 2}";

I hope it helps.

Try this.

public Form1() { InitializeComponent(); richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold); } private void richTextBox1_TextChanged(object sender, EventArgs e) { int lastCharacter = richTextBox1.TextLength; if (lastCharacter > 1) if (richTextBox1.Lines[0][lastCharacter - 1] == ' ') { richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Regular); } }

I hope this will help you. If any query then ask me. Thanks

更多推荐

如何在richtextbox中将第一个数字写为粗体数字

本文发布于:2023-10-27 18:51:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534238.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数字   中将   粗体   如何在   richtextbox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!