本文介绍了如何在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中将第一个数字写为粗体数字
发布评论