如何使部分文本在TextBox大胆? [英] How to bring partial text Bold in a TextBox?
本文介绍了如何使部分文本在TextBox大胆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有有以下文本一个TextBox。
I have one textbox which has the following text.
TextBox1.Text = "The above materials will be delivered at Site. One copy of the Delivery Challan / Invoice to be send to Head Office."
在这,我想作以下文字大写加粗交付Challan /发票的一份副本,以便发送到总部为也。
In that, I want to make the following text "One copy of the Delivery Challan / Invoice to be send to Head Office" as in Capital Letters and also in Bold.
我尝试了以下代码:
TextBox1.Font.Bold = true;
但它使所有的文本为粗体。我怎么做的?
But it made all the text as bold. How do I make it?
推荐答案
由于您使用的Web应用程序,您不能使用的 RichTextBox的组成部分。
Since you're using a web application, you can't use the RichTextBox component.
相反,你可以使用 LiteralControl
A 跨度
或 DIV 内code>。
Instead, you can use a LiteralControl
inside a span
or a div
.
即:
.aspx
<div runat="server" id="div1"></div>
.cs
div1.Controls.Add(new LiteralControl("this is normal text, "));
div1.Controls.Add(new LiteralControl("<b>And the rest of the sentence is bold</b>"));
这篇关于如何使部分文本在TextBox大胆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文