user1181950
user1181950

Reputation: 809

Embed html in C# Forms

Is there a way to embed HTML into a windows forms custom usercontrol? I want to create a lightweight control to be used in a .NET 4.0 application, but since the contents of it is viable to change, I was thinking using HTML to lay it out might be easiest. Is there a way to achieve this in windows forms? There are some other topics with C# and HTML but pretty sure non involves creating a control that parses HTML and displays it.

Thanks

Upvotes: 1

Views: 3890

Answers (3)

Seer
Seer

Reputation: 495

I have been trying to do a similar thing and have found awesomium. They have a dotnet and mono wrapper and quite fine grain control over the whole thing acts. It is also free as long as your company makes less than 100k a year.

Forgot to mention it is a browser that you basically embed in your application so you don't need to worry about the user not having it installed or anything and is consistant over pc's and OS's

Upvotes: 0

Raheel Khan
Raheel Khan

Reputation: 14787

A WebBrowser would be your best bet in terms of ease of use and maintenance. You can have further control over the contents themselves by accessing the browser.Document.DomDocument interfaces and events. I would not recommend using GDI since it can become a pain to maintain and manage custom rendering in the long run.

Upvotes: 0

Ry-
Ry-

Reputation: 224913

You could use a WebBrowser, but I'd recommend not going down that path. Just use traditional controls to accomplish what you need, if at all possible, maybe combined with a little GDI+.

Upvotes: 2

Related Questions