是的WindowsFormsHost适合目的(.NET WPF主办的WinForms)? [英] Is WindowsFormsHost fit for purpose (.net WPF hosting WinForms)?

查看:137
本文介绍了是的WindowsFormsHost适合目的(.NET WPF主办的WinForms)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个图形用户界面驱动的应用程序需要举办一些prebuilt的WinForms基础的组成部分。 这些组件提供了使用GDI +和DirectX的混合物高性能交互视图。 该意见处理控制输入和显示自定义的图形渲染。 在一个WinForms线束由供应商的部件进行测试。

A GUI driven application needs to host some prebuilt WinForms based components. These components provide high performance interactive views using a mixture of GDI+ and DirectX. The views handle control input and display custom graphical renderings. The components are tested in a WinForms harness by the supplier.

能否各种商用应用程序中使用WPF为它的图形用户界面,并依靠<一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx">WindowsFormsHost举办​​的WinForms组件或 有你的技术故障,例如经验输入滞后,更新的问题,将让你谨慎?

Can a commericial application use WPF for its GUI and rely on WindowsFormsHost to host the WinForms components or have you experience of technical glitches e.g. input lags, update issues that would make you cautious?

推荐答案

我们目前正在使用我们的软件主办的WinForms DataGridView控件的WindowsFormsHost,我们已经没有任何实际问题吧。有几件事情需要提防,但:

We're currently using WindowsFormsHost in our software to host the WinForms DataGridView control, and we've not had any real problems with it. A few things to watch out for though:

首先是href="http://msdn.microsoft.com/en-us/library/aa970688.aspx">空域限制中的

The first is the air-space restrictions. Practically speaking, this means that WinForms content always appears on top of WPF content. So if you are using WPF adorners they will appear to be "trimmed" if they hit up against a WinForms region in your app.

第二个问题是,因为他们使用的是Windows的资源,你必须更仔细地管理的WinForms组件的寿命。不像WPF成分,WinForms控件想到,当他们与成品予以处置。这使得棘手包括他们在纯XAML视图。

The second is that, because they use Windows resources, you have to manage the lifetimes of WinForms components more carefully. Unlike WPF components, WinForms controls expect to be Disposed when they're finished with. This makes it tricky to include them in a pure XAML view.

的最后一件事是,WinForms控件似乎并不那么顺利调整为WPF显示器的其余部分:他们往往捕捉到新的大小一旦您完成调整

The last thing is that WinForms controls don't seem to resize as smoothly as the rest of the WPF display: they tend to snap to their new size once you've finished making an adjustment.

这篇关于是的WindowsFormsHost适合目的(.NET WPF主办的WinForms)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆