简体   繁体   English

MFC应用程序中的C#控件

[英]C# controls in a MFC Application

I am responsible for the User Interface of an application written completely in Visual C++ using MFC and some third-part controls. 我负责使用MFC和一些第三方控件完全用Visual C ++编写的应用程序的用户界面。 I would like to use C# (WinForms or even better WPF) to improve the application look&feel. 我想使用C#(WinForms甚至更好的WPF)来改善应用程序的外观和感觉。

I would like some advices about how to do it. 我想知道如何做到这一点。 Links, articles, examples... 链接,文章,例子......

Right now the user interface is isolated in a single project and I don't want to compile the whole module with CLR. 现在用户界面被隔离在一个项目中,我不想用CLR编译整个模块。 So how do I have to manage that from the architectural point of view? 那么我如何从架构的角度来管理它呢?

I have already looked at the Internet for the subject and read MSDN information. 我已经查看了该主题的Internet并阅读了MSDN信息。 I would like more detailed information...is it convinient? 我想了解更详细的信息......方便吗? pros/cons? 优点缺点? have you used this approach successfully in a "big" application? 你有没有在“大”的应用程序中成功使用这种方法? I don't want to compile the whole ui project with CLR...can I just have all the .NET code in a isolated project and call it from the ui project? 我不想用CLR编译整个ui项目...我可以将所有.NET代码放在一个独立的项目中并从ui项目中调用它吗? what's the best way to do it? 什么是最好的方法呢?

Thanks in advance. 提前致谢。

一个很好的起点是MSDN上的Win32和WPF互操作页面。

我发现这个代码项目文章很好地介绍了混合mfc / winforms代码的主题。

When faced with the same problem, I made an ActiveX control in C# and used it in my MFC app. 当遇到同样的问题时,我在C#中创建了一个ActiveX控件并在我的MFC应用程序中使用它。 The folks at MS took out support for building ActiveX controls with .NET, but it's still possible to do so with a plain Jane COM class which has a custom [ComRegisterFunction()] and [ComUnregisterFunction] . MS的人们支持使用.NET构建ActiveX控件,但是仍然可以使用简单的Jane COM类来实现,它具有自定义[ComRegisterFunction()][ComUnregisterFunction]

Although MS would like to tell us that the /clr flag will solve our problems, it measurably slowed down my large MFC app. 虽然MS想告诉我们/ clr标志将解决我们的问题,但它显然减慢了我的大型MFC应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM