Run WinForms control inside WebForms and take scre

2019-06-08 19:47发布

问题:

Like the title says, is it possible to run a winforms component inside a asp.net website and then take a screenshot of it?

回答1:

It is possible to place a user control on a web page but my experience with it in the past were really bad.

I tried this back in 2005 and it worked on Internet Explorer only, and even in a well-defined intranet there were machines where it failed.

So I would vote against.

For the screenshot part, please see this SO posting.



回答2:

Short answer: no. The ASP.NET runtime won't let you create a Form within its sandbox. Access to the Graphics library is also tied to WinForms, so I doubt that will be much help.

I would take a look at WPF; the XAML markups for layout of controls can be rendered in a forms app or a web browser, allowing you to create a web control that looks like a windows form control.