VC:状态栏(AfxGetMainWnd()、GetDescendantWindow()、SetPaneInfo()、SetPaneText())

1、在String Table中设置语句的ID。
2、在CMainFrame下的indicator数组中添加项:
static UINT indicators[] =
{
 ID_SEPARATOR,           // status line indicator
 ID_MOUSE,
 ID_INDICATOR_CAPS,
 ID_INDICATOR_NUM,
 ID_INDICATOR_SCRL,
};
3、实例:
void CTestView::OnMouseMove(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
 CString str;
 str.Format("当前鼠标位置:%d,%d",point.x,point.y);
 CMainFrame *pmain=(CMainFrame*)AfxGetMainWnd();
 CStatusBar *pstatusbar=(CStatusBar*)pmain->GetDescendantWindow(AFX_IDW_STATUS_BAR);
 pstatusbar->SetPaneInfo(1,ID_MOUSE,SBPS_POPOUT,150);
 pstatusbar->SetPaneText(1,str);;
 CView::OnMouseMove(nFlags, point);
}

原文地址:https://www.cnblogs.com/shenchao/p/2737777.html