使用MFC创建GUI [英] Creating a GUI with MFC

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

问题描述

我最近开始学习MFC(专业书籍),我觉得这很困难.但是最困难的部分似乎是关于创建用户界面.似乎您必须知道控件的位置(基于对话框的应用程序不是如此).

I recently started learning MFC (Prosise book), and I feel like it's difficult. But the most difficult part seems to be about creating user interfaces. It seems like you have to know the positions your controls should be positioned at (not the case with dialog based apps).

您如何解决?您是先在Photoshop中绘制应用程序,然后在其中测量距离吗?

How do you get around that? Do you first draw the application in Photoshop, then measure the distances there?

而且,是否有用于它的GUI设计器? (以减轻痛苦). 我非常喜欢它,特别是因为它的速度和不需要大型框架的事实.

And also, are there any GUI designers for it? (to ease the pain). I like it a lot, especially because of the speed and the fact it doesn't require a big framework.

欢迎定期进行MFC编程的任何人给我一些有关如何擅长MFC编程的建议.

Anyone who does MFC programming regularly is welcome to give me advice on how to get good at programming MFC.

推荐答案

我必须同意,对于MFC工作,Visual Studio中的资源编辑器可能是使用MFC的最简单方法.您可以将控件放在对话框中,然后将它们拉伸到适当的比例.作为记录,MFC 一个框架,只是它作为Windows的一部分捆绑在一起.

I'd have to agree that for MFC work, the resource editor which is part of Visual studio is probably the easiest way to get going with MFC. You can just lay your controls out on a dialog and stretch them to appropriate proportions. For the record, MFC is a framework it's just that it comes bundled as part of Windows.

如果要调整控件的大小,则需要添加一些代码来处理在调整对话框大小时传递的调整大小消息(我认为是ON_SIZE).只要您不想一次调整大小/重新放置太多东西,这还算不错.

If you want your controls to resize, you'll need to add some code to handle the resize (ON_SIZE I think it is) messages delivered as the dialog is resized. This isn't too bad as long as you don't want to resize / reposition too many things at once.

我个人建议避免使用MFC,而推荐使用 WxWidgets .有一些很棒的GUI布局程序,例如 wxDesigner ,可以使创建可调整大小的对话框和属性页变得相当轻松.

Personally, I'd recommend avoiding MFC in favour of WxWidgets. There's some great GUI layout programs like wxDesigner which can make creating resizeable dialogs and property pages fairly effortless.

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

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