int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // Create the status bar m_StatusBar.Create(this); // Work out the width of the text we want to display CRect textRect; CClientDC aDC(&m_StatusBar); aDC.SelectObject(m_StatusBar.GetFont()); aDC.DrawText("View Scale:99", -1, textRect, DT_SINGLELINE| DT_CALCRECT ); // Setup a part big enough to take the text int width = textRect.Width(); m_StatusBar.GetStatusBarCtrl().SetParts(1, &width); // Initialize the text for the status bar m_StatusBar.GetStatusBarCtrl().SetText("View Scale:1", 0, 0 ); return 0; }