对话框中使用CStatusBarCtrl,如何使状态栏随窗口的最大化变化。

vericky 2003-12-08 03:32:50
如何
...全文
166 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ozzman 2004-02-02
  • 打赏
  • 举报
回复

void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIFrameWnd::OnSize(nType, cx, cy);

SetStatusPanel(cx);
}

void CMainFrame::SetStatusPanel(int nWidth)
{
const int nParts = 7;
int widths[nParts] = {nWidth-420, nWidth-300, nWidth-180, nWidth-145, nWidth-110, nWidth-75, -1};
if (m_wndStatusBar)
{
if (nWidth < 400)
{
widths[0] = nWidth*2/5;
widths[1] = nWidth*11/20;
widths[2] = nWidth*29/40;
widths[3] = nWidth*31/40;
widths[4] = nWidth*33/40;
widths[5] = nWidth*35/40;
widths[6] = -1;
}
}
else
return;
m_wndStatusBar.GetStatusBarCtrl().SetParts(nParts, widths);
}
vcforever 2003-12-09
  • 打赏
  • 举报
回复
agree checkyvc6(checkyvc6)
checkyvc6 2003-12-08
  • 打赏
  • 举报
回复
调用
在WM_SIZE里面调用
RepostionBars(AFX_IDW_CONSTROL_FIRST,AFX_IDW_CONSTROL_LAST,ID_STATUS);
应该就可以的
Semigod 2003-12-08
  • 打赏
  • 举报
回复
在Dialog的OnSize中对StatusBar进行MoveWindow

15,979

社区成员

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

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