问题描述
我不认为这是可能的,但我只是跟一个同事说,她谁之前,已经做了。难道她拉着我的锁链?
I didn't think it was possible but I was just talking to a co-worker who said she had done it before. Is she pulling my chain?
推荐答案
这不是你可以自动完成。
It's not something you can do automatically.
诀窍是,在这两个WinForms和WebForms的形式被重新由一个普通的老班psented $ P $。但是,每次处理一个事件为表单的时间在asp.net web表单,你正在使用的类的一个全新的实例。微软去了很多麻烦,试图盖此问题,尽可能,但最终它只是没有想到一个WebForm,在相同的条件作为一个WinForm是一个好主意。
The trick is that in both winforms and webforms a form is represented by a plain old class. However, every time you handle an event for your form in asp.net webforms you're working with a brand new instance of the class. Microsoft went to a lot of trouble to try cover for this issue as much as possible, but in the end it's just not a good idea to think of a webform in the same terms as a winform.
所以,你绝对可以采取WinForms应用程序,并把它改写使用web表单,但它只是说:重写
So you can definitely take a winforms app and rewrite it to use webforms, but it will be just that: a rewrite.
这篇关于是否有可能一个WinForm转换为.NET一个WebForm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!