Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a string : "Inventory (2)".I want to make "(2)" bold while displaying in the screen.How to achieve that.
Posted
Updated 25-Apr-18 2:19am
Comments
OriginalGriff 25-Jul-11 7:02am    
And what are you displaying it in?
Suresh Suthar 25-Jul-11 7:07am    
If it is win form application, than I think you have to use two different label. Make other lable's font style Bold...
Kunal Singha Roy 25-Jul-11 7:12am    
I am displaying it as treeview node.

I think below mentioned link can solve your problem



http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.drawnode.aspx[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Jul-11 11:10am    
That is correct, my 5.
Also, I suggested two CodeProject articles offering great controls to do such thing and more.
Please see my solution.
--SA
You would need to handle the DrawNode yourself. Using drawmode OwnerDrawText would be enough because you just want to customize the text style. Have a look at the link below:

http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.drawnode.aspx#Y570[^]

Good luck!
 
Share this answer
 
Comments
#realJSOP 25-Jul-11 7:43am    
5 - proposed as answer
Sergey Alexandrovich Kryukov 25-Jul-11 11:09am    
That is correct, my 5.
Also, I suggested two CodeProject articles offering great controls to do such thing and more.
Please see my solution.
--SA
There are two CodeProject article offering very helpful controls to do this based on HTML format.

See:
For System.Windows.Forms: A Professional HTML Renderer You Will Use[^],
for WPF: WPF HTML Supported TextBlock[^].

Next time, please always tag UI library you want to use.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900