简体   繁体   English

为c ++项目创建一个简单的GUI

[英]Create a simple GUI for c++ project

I created a project in c++ that run for hours. 我用c ++创建了一个运行了几个小时的项目。

I want to make a simple GUI (For Windows) that will let the user to choose between some inputs,and click on "start". 我想制作一个简单的GUI(For Windows),让用户在一些输入之间进行选择,然后点击“开始”。 and then, show him a progress bar which represent the percent of the computation that has been done. 然后,向他显示一个进度条,表示已完成的计算百分比。 (and probably a small animation). (可能是一个小动画)。

  1. What is the best way to do this? 做这个的最好方式是什么? I never made a Graphical interface before. 我以前从未做过图形界面。

  2. I try to use Visual Studio 2010: In new Project I choose Win32 Project , and I found where i change the menu, but I don't know how to edit the main form. 我尝试使用Visual Studio 2010:在新项目中我选择了Win32项目 ,我找到了更改菜单的位置,但我不知道如何编辑主窗体。 there is a tutorial? 有一个教程?

Thanks! 谢谢!

I heartily recommend Qt . 我衷心推荐Qt

You might also want to use Qt Creator as your IDE for added convenience, but this is not a requirement. 您可能还希望使用Qt Creator作为IDE以增加便利性,但这不是必需的。

What is the best way to do this? 做这个的最好方式是什么? I never made a Graphical interface before. 我以前从未做过图形界面。

The easiest way is to use the Visual Studio 2010 IDE and create a new WinForms Application templated project. 最简单的方法是使用Visual Studio 2010 IDE并创建一个新的WinForms Application模板化项目。

I try to use Visual Studio 2010: In new Project I choose Win32 Project, and I found where i change the menu, but I don't know how to edit the main form. 我尝试使用Visual Studio 2010:在新项目中我选择了Win32项目,我找到了更改菜单的位置,但我不知道如何编辑主窗体。 there is a tutorial? 有一个教程?

Microsoft provides tutorials on their websites and you can find many more via Google searches. Microsoft 在其网站上提供了教程 ,您可以通过Google搜索找到更多内容。

I believe there are several possibilities. 我相信有几种可能性。 If you are using VS2010, MFC might be one of them. 如果您使用的是VS2010,MFC可能就是其中之一。 Or you could also use .NET framework to build one. 或者您也可以使用.NET框架构建一个。 Also, Nokia Qt is another choice. 此外,诺基亚Qt是另一种选择。 Since you only want a simple GUI, I will suggest .NET framework, which could be easier and it is also together with VS2010. 由于您只需要一个简单的GUI,我建议使用.NET框架,它可以更容易,也可以与VS2010一起使用。

If you're sure you want to go win32 (raw): you can learn it here: http://www.winprog.org/tutorial/ 如果你确定要去win32(raw):你可以在这里学到它: http//www.winprog.org/tutorial/

Otherwise, use something like wxWidgets if you don't want to restrict yourself to windows 否则,如果您不想限制自己使用Windows,请使用类似wxWidgets的内容

如果您使用的是VS2010 Express,则没有MFC模板和所有支持库(http://msdn.microsoft.com/library/hs24szhzh.aspx),但您可以从SDK获取库。

To clear some things up: there isn't a "forms editor" for Win32 C++ projects, you have to code the GUI by hand using Win32 methods. 要清除一些内容:Win32 C ++项目没有“表单编辑器”,您必须使用Win32方法手动编写GUI。 The people here have suggested using .NET to design the GUI using the Visual Studio Designer. 这里的人建议使用.NET来使用Visual Studio Designer设计GUI。 This will work, but you'd either need to drive your C++ executable using the .NET GUI, or turn your C++ code into a class library that you can use in the GUI. 这将有效,但您需要使用.NET GUI驱动C ++可执行文件,或者将C ++代码转换为可在GUI中使用的类库。

If you use .net It's like a different language; 如果你使用.net它就像一种不同的语言; more confusing and slow with GC :/. 更令人困惑和缓慢的GC:/。 Qt is mature, very well documented and easily cross-platform. Qt已经成熟,文档齐全,易于跨平台。 Qt-creator is also very easy to use and not as heavy as VS. Qt-creator也很容易使用,而不像VS那么重。 Qt can be used for free commercial under the lgpl license. Qt可以在lgpl许可下用于免费商业。

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

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