STRINGTABLE DISCARDABLE
BEGIN ID_INDICATOR_POINT "마우스 위치 : X 좌표, Y 좌표"
END
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
// { ID_INDICATOR_POINT, //새로운 팬의 ID 추가
// }
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
...
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create }
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
...
}
void CPractice6_1View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// { // 메인프레임의 포인터 얻음
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CString strPoint;
strPoint.Format("마우스 위치 x : %d, y : %d", point.x, point.y);
// 새로 추가한 팬에 마우스 위치 출력 pFrame->m_wndStatusBar.SetPaneText(1, strPoint);
// }
CView::OnMouseMove(nFlags, point);
}
or
STRINGTABLE DISCARDABLE
BEGIN ID_INDICATOR_TIME "HH:MM"
END
class CTry01Dlg : public CDialog
{
// { CStatusBar m_statusBar;
// }
// Construction
public:
CTry01Dlg(CWnd* pParent = NULL); // standard constructor
...
// Generated message map functions
//{{AFX_MSG(CTry01Dlg)
... afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
BOOL CTry01Dlg::OnInitDialog()
{
...
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
// {
// Create status bar at the bottom of the dialog window if (m_statusBar.Create(this)) { m_statusBar.SetIndicators(auIDStatusBar, sizeof(auIDStatusBar)/sizeof(UINT));
/*
// Make a sunken or recessed border around the first pane
m_statusBar.SetPaneInfo(0, m_statusBar.GetItemID(0),
SBPS_STRETCH, NULL );
*/ }
// <<
// We need to resize the dialog to make room for control bars.
// First, figure out how big the control bars are.
CRect rcClientStart;
CRect rcClientNow;
GetClientRect(rcClientStart);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
0, reposQuery, rcClientNow);
// Now move all the controls so they are in the same relative
// position within the remaining client area as they would be
// with no control bars.
CPoint ptOffset(rcClientNow.left - rcClientStart.left,
rcClientNow.top - rcClientStart.top);
// Adjust the dialog window dimensions
CRect rcWindow;
GetWindowRect(rcWindow);
rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
MoveWindow(rcWindow, FALSE);
// >>
// And position the control bars RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
// }
return TRUE; // return TRUE unless you set the focus to a control
}
void CTry01Dlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}