c# - Bold a part of string in richtextbox -
this question has answer here:
- bold in richtextbox 2 answers
i trying bold part of string in richtextbox
. looks now:
okl-24-220-20-10.56
the last digits 10.56 stands square meters of specific calculation. want have bold. these numbers used generate barcode hoping doing this, barcode display 10.56 bold text.
i thought of using in summary richtextbox
:
var sb = new stringbuilder(); sb.append(@"{\rtf1\ansi"); sb.append(@"\b amount: \b0 "); sb.append((txtamount.text); sb.append(@" \line "); sb.append(@"\b length: \b0 "); sb.append(txtlength.text); sb.append(@" \line "); sb.append(@"\b width: \b0 "); sb.append(txtwidth.text); sb.append(@" \line "); sb.append(@"\b total: \b0 "); sb.append(txttotal.text); sb.append(@" \line \line "); sb.append(@"}"); rtxtrequest.rtf = sb.tostring();
[
i'm not 100% sure code show generating rtf (since it's not shown on screenshot), guess can like:
var rtf = $@"{{\rtf1\ansi okl-{txtamount.text}-{txtlength.text}-{txtwidth.text}-\b {txttotal.text}\b0}}"; displayrichtextbox.rtf = rtf;
i tested in case:
is want?
note depending on barcode generation technique, may or may not bold there.
Comments
Post a Comment