WPF中的WindowsFormHost元素 [英] WindowsFormHost Element in WPF
本文介绍了WPF中的WindowsFormHost元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在WPF应用程序中使用WindowsForm元素.为此我使用了"WindowsFormHost"元素.它可以工作,但是在运行时编译器给了我这个例外;
尽管设置了它,但设置属性"System.Windows.Forms.Integration.WindowsFormsHost.Child"引发了异常."
Hi,
I have to use a WindowsForm element in WPF application.I used for this purpose "WindowsFormHost" element.It works but,at runtime compiler gives me this exception ;
"Set property ''System.Windows.Forms.Integration.WindowsFormsHost.Child'' threw an exception.''" although I set it;
myFormHost = new WindowsFormsHost();
myForm = new Form();
myFormHost.Child=myForm;
预先感谢您的答复..
Thanks in advance for your replies..
推荐答案
本文将帮助您入门- http://www.switchonthecode.com/tutorials/wpf-tutorial-using-winforms-in-wpf [ ^ ]
另一个- http://codegod.org/WebAppCodeGod/Integration-of-WinForms -in-WPF-Applications-AID405.aspx [
Hi,
This article will help you get started - http://www.switchonthecode.com/tutorials/wpf-tutorial-using-winforms-in-wpf[^]
Another one - http://codegod.org/WebAppCodeGod/Integration-of-WinForms-in-WPF-Applications-AID405.aspx[^]
I think the controls of the Forms can be hosted in a WPF application and not the whole form but I´m not sure.
Good luck :thumbsup:
使用此
主机=新elementhost();
wpf = new control.page1()
grid2.children.add(wpf);
Use this
host = new elementhost();
wpf = new control.page1()
grid2.children.add(wpf);
这篇关于WPF中的WindowsFormHost元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文