我的状态栏为什么只有第一次显示东西?在线等候。
我的状态栏在对话框最大或最小时不显示文本,为什么?
代码是这样的:
static UINT indicators[] =
{
ID_SEPARATOR,
ID_SEPARATOR,
ID_SEPARATOR,
};
void CICDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CRect r;
GetClientRect(&r);
TRACE("%d\n",r.Height());
m_wndStatusBar.MoveWindow(0 ,r.Height()-20 ,r.Width(),50,TRUE);
UINT nID,nStyle;
int cxWidth;
m_wndStatusBar.GetPaneInfo(0,nID,nStyle,cxWidth);
m_wndStatusBar.SetPaneInfo(0,nID,SBPS_STRETCH,cxWidth);
m_wndStatusBar.GetPaneInfo(1,nID,nStyle,cxWidth);
m_wndStatusBar.SetPaneInfo(1,nID,0,80);
m_wndStatusBar.GetPaneInfo(2,nID,nStyle,cxWidth);
m_wndStatusBar.SetPaneInfo(2,nID,0,80);
CString Date;
CTime Time=CTime::GetCurrentTime();
Date=Time.Format("%y-%m-%d");
m_wndStatusBar.SetPaneText(1,Date);
m_wndStatusBar.UpdateWindow();
}
int CICDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if (!m_wndStatusBar.CreateEx (this,0,WS_CHILD|WS_VISIBLE|CBRS_BOTTOM|WS_BORDER)|| !m_wndStatusBar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT)))
{
TRACE("Failed Created StatusBar\n");
return -1;
}
return 0;
}