在Ribbon下没有CStatusBar,怎么更新呢?我在网上搜了半天也没找到结果,到国外的网站也看了看,有几个可能有结果的还没屏蔽了,无语中。。。后来又找MSDN,在运气的帮助下,找到了一个方法,我不知道这个方法有没有什么副作用,不过至少要求的功能实现了。好了,直接上代码。
在View类中实现OnMouseMove(UINT nFlags, CPoint point),其中代码如下:
CString str;
str.Format("鼠标指针的当前坐标(X:%d, Y:%d)", point.x, point.y);
CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CMFCRibbonStatusBar* statusBar = (CMFCRibbonStatusBar*)&pFrame->m_wndStatusBar;
statusBar->SetInformation(str);
在这里使用了CMFCRibbonStatusBar::SetInformation,成功。
void SetInformation(LPCTSTR lpszInfo);
Remarks:Use this method to put the status bar in the information mode. In this mode, the status bar hides all panes and displays the information string specified bylpszInfo.
When lpszInfo is NULL, the status bar reverts to regular mode.