读书人

有关问题有关问题又有有关问题 WP

发布时间: 2012-01-05 22:36:54 作者: rapoo

问题,问题,又有问题 WPF 嵌入 WindowsFrom 控件问题
代码如下:

System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
//创建 WinForme 控件
System.Windows.Forms.NotifyIcon notifyicon = new System.Windows.Forms.NotifyIcon();

host.Child = notifyicon;
LayoutRoot.Children.Add(host);

这样会有个错误,不能编译,不知道各位有没有什么好方法?

错误如下:

错误2无法将类型“System.Windows.Forms.NotifyIcon”隐式转换为“System.Windows.Forms.Control”

谢谢

[解决办法]
强制转换,OK了就结帖吧
[解决办法]
那个是 Component, 加入 Container

读书人网 >.NET

热点推荐