关于 CStatusBar的简单用法的转载。

vc CStatusBar用法

//1 resource.h
#define ID_INDICATOR_TIP                1001
#define ID_INDICATOR_CLIENTNUM          1002
#define ID_INDICATOR_RUNTIME            1003
#define ID_INDICATOR_TIME               1004

//2 *.cpp 公共定义和声明                           
static UINT BASED_CODE indicators[] =
{
ID_INDICATOR_TIP,
ID_INDICATOR_CLIENTNUM,
ID_INDICATOR_RUNTIME,
};
CStatusBar m_bar;

//3 *.cpp OnInitDialog()
{
m_bar.Create(this);
m_bar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT));
m_bar.SetPaneInfo(0,ID_INDICATOR_TIP, SBPS_NORMAL,150);
m_bar.SetPaneInfo(1,ID_INDICATOR_CLIENTNUM, SBPS_NORMAL,150);
m_bar.SetPaneInfo(2,ID_INDICATOR_RUNTIME, SBPS_NORMAL,150);
m_bar.SetPaneText(1,"Welcome come here",TRUE); //set new pane1 text
m_bar.SetPaneText(2,"You can get a sweet felling",TRUE); //set new pane2 text
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,ID_INDICATOR_TIME);
}

你可能感兴趣的:(关于 CStatusBar的简单用法的转载。)