简体   繁体   English

.NET GUI组件是否支持HTML(就像Java swing一样)?

[英]Do .NET GUI components support HTML (like Java swing does)?

HTML can be used in Java swing GUI components , like JTextBox , JButton , ... etc. HTML可以在Java swing GUI组件中使用 ,例如JTextBoxJButton等。

Is there an equivalent to that in .NET (C#) WinForms? .NET(C#)WinForms中是否有与之等效的东西? Or at least some simple way of making a single word bold inside a textbox without using another GUI component? 还是至少有一些简单的方法可以在不使用其他GUI组件的情况下使文本框内的单词变为粗体

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. 对于.Net,您将需要使用RichTextbox控件(和rtf格式),嵌入WebBrowser控件或从文本框继承您自己的OwnerDrawn控件。

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. 如果没有第三方控件可以为您做最后的选择,我会感到惊讶,但是对此没有任何“官方”内容,您必须自己进行评估。

No, I don't think you can easily do that with a normal TextBox or Button. 不,我认为使用普通的TextBox或Button可以轻松做到这一点。 There are third party controls that might do that. 有第三方控件可能会这样做。 WinForms is not a very extensible GUI framework at heart. WinForms本质上不是一个非常可扩展的GUI框架。 If you are looking for that kind of capabilities, WPF is a great thing. 如果您正在寻找这种功能,那么WPF就是一件好事。 WPF supports control composition and styling almost everywhere. WPF几乎在任何地方都支持控件组合和样式。

一种选择是使用WPF TextBlock(我认为)控件,该控件支持HTML之类的基本格式(但HTML标记本身不支持)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM