Share via


Initializing the Parts of a CStatusBarCtrl Object

OverviewSample

By default, a status bar displays status information using separate panes. These panes (also referred to as parts) can contain either a text string, an icon, or both.

Use to define how many parts, and the length, the status bar will have. After you have created the parts of the status bar, make calls to and to set the text or icon for a specific part of the status bar. Once the part has been successfully set, the control is automatically redrawn.

The following example initializes an existing CStatusBarCtrl object (m_pStatBarCtrl) with four panes and then sets an icon (IDR_LIGHT1) and some text (IDC_PART1_STR) in the second part.

int strPartDim[4]= {80, 160, 240, -1};
CMyApp* pApp= (CMyApp*) AfxGetApp();

m_icon1= pApp->LoadIcon(IDR_LIGHT1);

m_pStatBarCtrl->SetParts(4, strPartDim);
m_pStatBarCtrl->SetIcon(1, m_icon1);
m_pStatBarCtrl->SetText(IDC_PART1_STR, 1, 0);

For more information on setting the mode of a CStatusBarCtrl object to simple, see Setting the Mode of a CStatusBarCtrl Object.

See Also   Windows Common Controls and MFC Classes