You first need to create a status bar object:
CStatusBar M_statusbar; Status bar
And then in the initialization program,
Create status bar M_statusbar.create (this); M_statusbar.setindicators (indicators,sizeof (indicators)/sizeof (UINT)); CRect rect; GetWindowRect (rect); M_statusbar.setpaneinfo (0,id_stautstip,sbps_stretch, rect. Width ()/4); M_statusbar.setpaneinfo (1,id_stautsspeed,sbps_normal, rect. Width ()/4); M_statusbar.setpaneinfo (2,id_stautsport,sbps_normal, rect. Width ()/4); M_statusbar.setpaneinfo (3,id_stautscount,sbps_normal, rect. Width ()/4);//m_statusbar.setpanetext (0, "ready");//m_statusbar.setpanetext (1, "Speed: 0kb/s");//m_statusbar.setpanetext (2, "Port: 8888");//m_statusbar.setpanetext (3, "Connection: 0"); RepositionBars (afx_idw_controlbar_first,afx_idw_controlbar_last,0);//Very IMPORTANT * * *
The indicators structure is defined as follows:
Static UINT indicators[] ={id_stautstip, //status line Indicatorid_stautsspeed,id_stautsport,id_stautscount};
Here the red associative string tabel in the struct,
If there is no associated string, you can use the SetPaneText function to set the contents of the status bar
The effect is as follows:
Add a status bar based on a dialog box MFC program