Status Bar Help Required
-
I want to code the Status Bar so that it displays the co-ordinates of mouse when i move the mouse. i created a pane for it and tried to handle the onmousemove event in the CMainFrame class but it didnt work. Plz help me with it
-
I want to code the Status Bar so that it displays the co-ordinates of mouse when i move the mouse. i created a pane for it and tried to handle the onmousemove event in the CMainFrame class but it didnt work. Plz help me with it
-
I want to code the Status Bar so that it displays the co-ordinates of mouse when i move the mouse. i created a pane for it and tried to handle the onmousemove event in the CMainFrame class but it didnt work. Plz help me with it
hi:maybe ,i can help you some:the program i have run well, void CMainFrame::OnViewStatusBar() { m_wndStatusBar.ShowWindow((m_wndStatusBar.GetStyle()&WS_VISIBLE)==0); RecalcLayout(); } void CMainFrame::OnUpdateViewStatusBar(CCmdUI* pCmdUI) { pCmdUI->SetCheck((m_wndStatusBar.GetStyle()&WS_VISIBLE)!=0); } void CMainFrame::OnUpdateLeft(CCmdUI* pCmdUI) {pCmdUI->Enable(::GetKeyState(VK_LBUTTON)<0); } void CMainFrame::OnUpdateRight(CCmdUI* pCmdUI) { pCmdUI->Enable(::GetKeyState(VK_RBUTTON)<0); } void CStatusbool514View::OnMouseMove(UINT nFlags, CPoint point) { //CView::OnMouseMove(nFlags, point); CString str; CMainFrame* pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd; CStatusBar* pStatus=&pFrame->m_wndStatusBar; if(pStatus) { str.Format("x=%d",point.x); pStatus->SetPaneText(0,str); str.Format("y=%d",point.y); pStatus->SetPaneText(1,str); } } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {....... if (!m_wndStatusBar.Create(this, WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,ID_MY_STATUS_BAR)|| !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } } static UINT indicators[] = { ID_SEPARATOR, ID_SEPARATOR, ID_INDICATOR_LEFT,//(3)(4)you yourself define in string table ID_INDICATOR_RIGHT,// status line indicator };