- CStatusBar m_StatusBar; // 成员变量
- // 全局变量
- static UINT auIDStatusBar[] =
- {
- ID_SEPARATOR
- };
- //在对话框类的WM_CREATE消息的响应函数OnCreate中加入下面的代码
- ModifyStyle(0, WS_THICKFRAME);
- //在对话框类的OnInitDialog()中加入下面的代码
- if(m_StatusBar.Create(this))
- {
- m_StatusBar.SetIndicators(auIDStatusBar, sizeof(auIDStatusBar) / sizeof(UINT));
- m_StatusBar.SetWindowText(_T(""));
- m_StatusBar.SetPaneStyle( 0, SBPS_STRETCH | SBPS_NOBORDERS );
- RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
- }
- // WM_SIZE消息处理函数OnSize中加入
- if(m_StatusBar.GetSafeHwnd())
- {
- RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
- }
效果图如下所示:
http://blog.csdn.net/visualeleven/article/details/6223577