在MFC应用程序中使用WPF [英] Using WPF in MFC application

查看:99
本文介绍了在MFC应用程序中使用WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在VS2010中用VC ++开发的应用程序。我需要匹配Android外观的UI,即它很丰富。但是使用VC ++我面临着丰富的UI限制。我搜索它,发现我们可以在MFC应用程序中托管WPF以获得丰富的UI。我想知道是否有可能获得丰富的UI以及我是否会获得更多的控件灵活性(例如VC ++ CListControl不会在同一行中提供多行文本)。如果有另一种选择。此外,我需要考虑关于寡妇8的这一发展。

请建议....

I have an application which is developing in VC++ in VS2010. I need to match up the UI of Android look and feel i.e. it shd be rich. But with VC++ I am facing limitation of rich UI. i search for it and found out that we can host WPF in MFC application to get rich UI. I would like to know is it possible to get rich UI and also whether I will get more controls flexibility (e.g. VC++ CListControl does not provide multi-lining of text in a same row). If there is another alternative for this. Also I need to consider this development with respect to Widows 8.
Pls suggest....

推荐答案

这将是如此困难,以至于无论你有多少用户界面,完全摆脱MFC都会很容易。请记住,您还需要维护它。原则上,我可以解释可能涉及的内容,但最好不要让我进入它。这非常困难,并且使解决方案可靠地工作几乎是不可能的。



好​​吧,只需几句话:MFC是一个非常接近Windows API的普通窗口应用程序。相比之下,WPF与Windows几乎没有关系。只有它的主窗口是Windows窗口。它基于DirectX,并没有WPF窗口内部的Windows消息。您无法通过消息与其他组件通信。您不能直接将WPF控件插入窗口或Windows控件到WPF控件。您无法在一个线程中运行Windows和WPF主事件循环。等等...



-SA
This would be so difficult that getting rid of MFC completely would be much easy, no matter how much UI you might have. And remember that you also would need to maintain it. In principle, I can explain what could be involved, but better don''t make me going into it. This is extremely difficult, and making the solution working reliably is nearly impossible.

Well, just a few words: MFC is a normal window application very close to Windows API. In contrast, WPF has very little to do with Windows. Only its main window is a Windows window. It is based on DirectX, and there is no Windows message pumping the the internals of the WPF window. You cannot communicate with other components via messages. You cannot directly insert a WPF control into a window or a windows control into WPF control. You cannot run Windows and WPF main event loop in one thread. And so on…

—SA


这篇关于在MFC应用程序中使用WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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