在对话框上创建状态栏

static UINT indicators[] =
{
ID_SEPARATOR,           // status line indicator
ID_SEPARATOR,
ID_SEPARATOR,
ID_SEPARATOR

};

在OnCreate函数中

if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
 sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;      // fail to create
}

在OnInitDialog函数中

CRect rct;
m_wndStatusBar.GetWindowRect(&rct);
::MoveWindow(this->GetSafeHwnd(), 100, 100, 800, 600 + rct.Height(), TRUE);

GetClientRect(&rct);

m_wndStatusBar.SetPaneInfo(0, ID_SEPARATOR, SBPS_NORMAL, rct.Width() / 5 - 5);
m_wndStatusBar.SetPaneInfo(1, ID_SEPARATOR, SBPS_NORMAL, rct.Width() / 5 - 5);
m_wndStatusBar.SetPaneInfo(2, ID_SEPARATOR, SBPS_NORMAL, rct.Width() / 5 - 5);
m_wndStatusBar.SetPaneInfo(3, ID_SEPARATOR, SBPS_STRETCH, rct.Width() / 4 - 5);


RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,ID_SEPARATOR);
//m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(180,180,180));


m_wndStatusBar.SetPaneText(0, _T("中文"));
m_wndStatusBar.SetPaneText(1, _T("无线"));
//m_wndStatusBar.SetPaneText(2, _T("报警"));
m_wndStatusBar.SetPaneText(3, _T("单位"));

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值