简体   繁体   English

如何在MFC中的对话框中设置控件的初始位置?

[英]How to set the control's initial position in dialog in MFC?

In MFC, I've made a resizing dialog in MFC and I put one control on a dialog like slider. 在MFC中,我在MFC中创建了一个调整大小的对话框,我在一个像滑块这样的对话框上放了一个控件。 After the build, I found that the slider does not move when I resize the dialog. 在构建之后,我发现当我调整对话框大小时滑块不会移动。 So I made OnSize() then I set the position. 所以我制作了OnSize()然后我设置了位置。 It works. 有用。 However, there is one problem which is the different between control's first position and second position in Onsize() . 但是,有一个问题是在Onsize()控件的第一个位置和第二个位置之间的差异。

So I want to make so that there is no difference in control's position between the first run dialog and after resizing. 所以我想这样做,以便在第一次运行对话框和调整大小之后控件的位置没有区别。

How to set the control's initial position in dialog in MFC? 如何在MFC中的对话框中设置控件的初始位置?

Ignore all WM_SIZE messages you receive until OnInitDialog is executed... 忽略收到的所有WM_SIZE消息,直到执行OnInitDialog为止...

WM_INITDIALOG is fired when the dialog ist just before to be shown or was already shown (if it has the visible style). 当对话框刚刚显示或已经显示(如果它具有可见样式)时,将触发WM_INITDIALOG

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

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