Add status bar for the dialog box VC

The main steps to achieve the status bar is added to the dialog box procedure is as follows:

1. String resources in the table to add two string resources

Resource ID resource values

IDS_PANEL1 first Panel

IDS_PANEL2 Second Panel

2. Join CStatusBar member variable in your dialog class

    CStatusBar  m_wndStatusBar;

3. It is defined as a striped array in StdAfx.h file

static UINT indicators[] =

{

         IDS_PANEL1,

         IDS_PANEL2,

};

4. OnInitDialog created and displayed in the status bar

    CRect rect;

       GetClientRect(rect);

       //状态条

       if (!m_wndStatusBar.Create(this)||

              !m_wndStatusBar.SetIndicators(

              indicators,sizeof(indicators)/sizeof(UINT)))

       {

              TRACE0("创建状态栏失败\n");

              return -1;      // 未能创建

       }

       m_wndStatusBar.MoveWindow(0, rect.bottom-20, rect.right, 20 );

Reproduced in: https: //www.cnblogs.com/rogee/archive/2011/02/15/1954990.html

Guess you like

Origin blog.csdn.net/weixin_33739627/article/details/94681176