简体   繁体   English

VisualStudio中的Windows GUI应用程序

[英]Windows GUI applications in VisualStudio

What are the valid ways to write (hopefully native) C++ applications with GUI in VS 2010? 在VS 2010中使用GUI编写(希望本机)C ++应用程序的有效方法是什么?

I remember some 10 years ago I was using MFC, any big changes today? 我记得大约10年前我使用过MFC,今天有什么重大变化吗?

If you want to stay with Native API then MFC is still a good choice or plain Win32 API. 如果你想继续使用Native API,那么MFC仍然是一个不错的选择或简单的Win32 API。
There are new controls like the ribbon control introduced in VS2010. 有一些新的控件,如VS2010中引入的色带控件。 There's a tutorial on native development with VS2010 on MSDN . 在MSDN上有VS2010的本机开发教程 There are also a lot of C++0x features available to your native program if you're using VS2010. 如果您使用的是VS2010,那么您的本机程序还可以使用许多C ++ 0x功能。

Qt is another good choice even if you aren't going cross platform but you won't be using VS 2010 most likely in that case. Qt是另一个不错的选择,即使你不是跨越平台,但在这种情况下你很可能不会使用VS 2010。 The licensing is now free for commercial use with LGPL. 该许可现在可以免费用于LGPL的商业用途。

If you are going to use a newer framework like WPF from Microsoft then you will need to use a managed language (.NET). 如果您打算使用像Microsoft这样的WPF这样的新框架,那么您将需要使用托管语言(.NET)。 Another choice is Silverlight for both web and apps. 另一个选择是Silverlight,适用于网络和应用程序。 Silverlight apps have the advantage that you can get them to work even on Mac if they have Silverlight installed. Silverlight应用程序的优势在于,如果安装了Silverlight,您甚至可以在Mac上使用它们。 Winforms is still easy to code but mostly superseded by WPF. Winforms仍然易于编码,但大部分都被WPF取代。

Unless you have good reason to do so, you can develop much faster with a framework like WPF instead of MFC. 除非你有充分的理由这样做,否则使用WPF而不是MFC这样的框架可以更快地开发。 Even if you don't know a managed language. 即使你不懂托管语言。 (If you don't go straight to C# instead of C++/CLI). (如果不直接使用C#而不是C ++ / CLI)。 WPF also offers GPU acceleration. WPF还提供GPU加速。

You can use Windows Forms, or Windows Presentation Foundation (WPF) - in VS2010 you can use either of these to create apps with a GUI. 您可以在VS2010中使用Windows窗体或Windows Presentation Foundation(WPF),您可以使用其中任何一种来创建具有GUI的应用程序。 In terms of which would be the best - I suppose that depends on your specific needs, but I couldn't say as I've only really used WinForms. 就哪个是最好的 - 我想这取决于你的具体需求,但我不能说因为我只是真的使用了WinForms。 However, WPF apps seem to have more components for you to use. 但是,WPF应用程序似乎有更多组件供您使用。

仅仅为了完整性 - 不提倡它, wxWidgets是一个跨平台的GUI工具集。

If you really want native, and you really want C++, your best option is WX. 如果你真的想要原生,并且你真的想要C ++,那么你最好的选择就是WX。 MFC has some nice controls and such but still lacks any semblance of a complete UI library. MFC有一些很好的控件,但仍然没有完整的UI库的任何外观。 It lacks any layout managers, period and still suffers from being a basic wrapper to the win32 C API. 它缺少任何布局管理器,期间仍然是win32 C API的基本包装器。 WX has some of this latter issue as well but has been cleaned up considerably from MFC and has layout managers. WX也有后一个问题,但已经从MFC中大大清理并且有布局管理器。

A couple other options: 其他几个选择:

You could break out of C++ and go with one of the .NET languages to use other, better native libraries. 您可以打破C ++并使用其中一种.NET语言来使用其他更好的本机库。

You could use a cross-platform library that'll still have the look and feel of the native toolkits, like Qt or GTKmm. 你可以使用一个跨平台的库,它仍然具有原生工具包的外观和感觉,如Qt或GTKmm。

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

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