关于OnSize()事件中控件的移动,有没有好的方法?

saprina 2005-06-02 10:39:03
关于OnSize()事件中控件的移动,我一般用下面的方法:

CDialog::OnSize(nType, cx, cy);
ReSetControls(cx,cy);//使用MoveWindow一个一个得移动控件
Invalidate(TRUE);
GetRects();//得到所有控件的新位置

因为在ReSetControls中有很多控件需要移动,所以窗口在改变大小时,控间的移动地先后顺序很明显,延迟时间也比较长(因为控件实在是不少),很不好看。
有没有其他的方法,能够让控件看上去好像一起移动??
...全文
135 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
CodeKey 2005-07-13
  • 打赏
  • 举报
回复
The WM_SIZE message is sent to a window after its size has changed.

The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.

//可以这样试试:
OnSize()
{

ShowWindow(SW_HIDE);

ReSetControls(cx,cy);

ShowWindow(SW_SHOW);

}
phoniex 2005-07-11
  • 打赏
  • 举报
回复
关注
如何捕捉 在Sizing结束(鼠标左键弹起)时触发的消息?
或者,这个消息 是什么
over1982 2005-06-02
  • 打赏
  • 举报
回复
按照控件之间的比例来
rList.left = 0;
rList.top = (rList.bottom/2-rList.bottom/5);

rStat.bottom = rList.top * 4/5;
rStat.top = rStat.bottom - 20 ;
rStat.right = rList.right * 7/8 ;
rStat.left = rStat.right - 69;
cdeee 2005-06-02
  • 打赏
  • 举报
回复

你这样是因为 OnSize 处理得太过频繁造成的,你不因该每次调用 OnSize 的时候都移动子控件,而是应该在窗口尺寸调整完毕后在进行移动。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧