使用 VS6 C++ 以屏幕(像素)为单位调整全屏窗口大小 GUI编辑器,MFC?
我正在尝试创建一个包含许多控件的全屏控制面板窗口:按钮、滑块、列表框等。
我可以创建一个对话框窗口并向其中添加控件,但所有内容都以对话框单位缩放。 我只想在 GUI 编辑器中创建一个以像素为单位缩放的窗口,而不是像对话框单位那样的派生单位。
我可以在 GUI 编辑器中布置所有控件,然后使用 SetWindowPos 以编程方式将窗口大小调整为全屏,但 GUI 编辑器中的对话框窗口看起来与最终产品不同。 我希望它在 GUI 编辑器中是所见即所得的。
这是运行 XP 的小型专用仪器控制计算机的前端。 SDK是用MFC编写的。 我必须经常添加和更改控件。 屏幕很小,7" @ 800 x 600,所以我当然是在另一台计算机上开发程序。我不希望程序窗口在更换显示器时发生变化 - 我希望它固定在 800 x 600,我希望控件的大小和布局也能固定,
这比默认功能更基本,
谢谢。
I am trying to create a full-screen control panel window with many controls: buttons, sliders, list boxes, etc.
I can create a dialog window and add controls to it, but everything is scaled in dialog units. I just want to create a window in the GUI editor that is scaled in pixels, not derived units like dialog units.
I can sort of lay out all the controls in the GUI editor and then resize the window programmatically to full-screen using SetWindowPos, but the dialog window in the GUI editor will not look the same as the final product. I want it to be WYSIWIG in the GUI editor.
This is the front end for a small dedicated instrument control computer running XP. The SDK is written in MFC. I have to add and change controls frequently. The screen is small, 7" @ 800 x 600, so of course I am developing the program on a different computer. I don't want the program window to change when I change monitors -- I want it fixed at 800 x 600, and I want the controls to be fixed in size and layout as well.
There must be a way -- this is more basic than the default functionality.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对话框单位基于对话框使用的字体的属性。 水平对话框单位等于当前字体平均宽度的 1/4。
垂直对话框单位等于当前字体平均字符高度的 1/8。
我建议使用 方法 2 (MapDialogRect() 对于 4 x 8 对话框)来计算找出 800x600 在输出显示器上对应多少个 DLU,然后制作一个等于该尺寸的参考表格。 您稍后可以在设计时使用该参考表格。
ps-我很高兴 Visual Studio 不再强调对话框单元,因为它们总是很难处理。
Dialog Units are based on properties of the font used by the dialog. A horizontal dialog unit is equal to 1/4th the average width of the current font.
A vertical dialog unit is equal to 1/8th the average character height of the current font.
I'd recommend using method 2 (MapDialogRect() for a 4 x 8 dialog) to figure out how many DLUs 800x600 corresponds to on your output display then make a reference form equal to that size. You can later use that reference form while you're designing.
p.s.-I'm glad Visual Studio no longer emphasizes dialog units since they were always a pain to deal with.
谢谢。 我只需在 GUI 编辑器中一遍又一遍地手动调整表单大小,直到它完全填满屏幕,就可以制作参考表单……别开玩笑了,对话框单元很痛苦。 从您的回复来看,我想在当前的 Visual Studio 中是否有更好的方法来做到这一点? (这是我第一次接触Windows编程)。
Thanks. I was able to make a reference form by just resizing the form manually in the GUI editor over and over again until it exactly filled the screen... No kidding that dialog units are a pain. From your response, I guess in the current Visual Studio there is a better way to do this? (This is my first experience with Windows programming).