首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

WPF项目怎么调用winform项目中的自定义控件

2013-09-25 
WPF项目如何调用winform项目中的自定义控件一个WPF项目、一个Winform下的写的usercontrol,想在WPF项目中调

WPF项目如何调用winform项目中的自定义控件
一个WPF项目、一个Winform下的写的usercontrol,想在WPF项目中调用此usercontrol,请问如何引用并且添加到WPF窗体上?
[解决办法]
have a try,http://hi.baidu.com/stuoopluwqbbeod/item/32ec38403da42ee2bcf45167
[解决办法]
Geomam.UserControl1 xx = new Geomam.UserControl1();
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();     
            host.Child = xx;
            this.MStackPanel.Children.Add(host);
[解决办法]

引用:
Geomam.UserControl1 xx = new Geomam.UserControl1();
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();     
host.Child = xx;
this.MStackPanel.Children.Add(host);

自己可以写一个加载winfrom的用户控件
[解决办法]




引用:
Quote: 引用:

Geomam.UserControl1 xx = new Geomam.UserControl1();
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();     
            host.Child = xx;
            this.MStackPanel.Children.Add(host);


就这些么? 不需要引用什么之类的么





1.引用 WindowsFormsIntegration.dll
 
2.MStackPanel是Grid的Name------------<Grid Name="MStackPanel" />
3.Geomam.UserControl1 xx = new Geomam.UserControl1();这里你用你自己的控件

热点排行