views:

232

answers:

3

HTML can be used in Java swing GUI components, like JTextBox, JButton, ... etc.

Is there an equivalent to that in .NET (C#) WinForms? or at least some simple way of making a single word bold inside a textbox without using another GUI component?

+3  A: 

For .Net you'll need to either use a RichTextbox control (and rtf formatting), embed a WebBrowser control, or inherit your own OwnerDrawn control from textbox.

I would be surprised if there aren't third-party controls out there that do that last option for you, but there's nothing "official" for this and you'll have to evaluate them yourself.

Joel Coehoorn
+1  A: 

No, I don't think you can easily do that with a normal TextBox or Button. There are third party controls that might do that. WinForms is not a very extensible GUI framework at heart. If you are looking for that kind of capabilities, WPF is a great thing. WPF supports control composition and styling almost everywhere.

Mehrdad Afshari
+1  A: 

One option would be to use a WPF TextBlock (I think) control which has support for basic formatting like HTML (but not HTML tag themselves).

Mladen Mihajlovic