Add a status bar based on a dialog box MFC program

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.