c# - Bold a part of string in richtextbox -


this question has answer here:

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(); 

desired output

[desired output[2]

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:

enter image description here

is want?

note depending on barcode generation technique, may or may not bold there.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -