我可以使用C + + / CLI(.NET Winforms / WPF)来提供GUI的本地C& C ++ [英] Can I use C++/CLI (.NET Winforms/WPF ) to provide GUI for app written in native C & C++
问题描述
我有一个应用程序写C& C ++。现在,我需要为这个应用程序提供一个GUI。 MFC是我最好的选择。但我不熟悉MFC。
I've an app written C & C++. Now, I need to provide a GUI for this app. MFC is the best option for me. But I'm not familiar with MFC.
那么我可以使用.NET来构建GUI吗?如果是,如何?请清除。
So can I use .NET to build GUI for this? If so, How? Please be clear.
如果我可以使用.NET我想我可以使用WPF太正确吗?
If I can use .NET I guess I can use WPF too right?
推荐答案
您可以在技术上在C ++ / CLI中编写GUI,但我会高度劝阻。 C ++ / CLI适用于在本机C ++上编写.NET包装器,并将其暴露给其他.NET语言,但不会太多。
You can technically write a GUI in C++/CLI, but I would highly discourage it. C++/CLI is good for writing .NET wrappers around native C++ and exposing it to other .NET languages, but not much else.
真的设置使用WinForms / WPF,然后我建议使用C ++ / CLI创建一个包装你的C ++代码,然后在C#中构建实际的GUI。
In your case, if you're really set on using WinForms/WPF, then I would suggest using C++/CLI to create a wrapper around your C++ code and then building the actual GUI in C#.
否则,像 Qt 或 wxWidgets 这样的C ++库也足以执行原生C ++ GUI。
Otherwise, a C++ library like Qt or wxWidgets would also suffice for doing a "native" C++ GUI.
这里有一个快速介绍C ++ / CLI 。这是C ++ / CLI入门的快速入门指南。一旦你构建一个C ++ / CLI DLL,你可以添加它作为你的C#项目和It Just Works(tm)的引用。
Here's a quick introduction to C++/CLI. This is a quick-start guide for getting started with C++/CLI. Once you build a C++/CLI DLL, you can just add it as a reference to your C# project and It Just Works(tm).
这篇关于我可以使用C + + / CLI(.NET Winforms / WPF)来提供GUI的本地C& C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!