16,472
社区成员
发帖
与我相关
我的任务
分享
static UINT indicators[] =
{
ID_SEPARATOR,
};
int CMainFrame::OnCreate(LPCREATESTRUCT lpcs)
{
if( CFrameWnd::OnCreate(lpcs) == -1 )
return -1;
if( !m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT)) )
{
TRACE0("Failed To Create StatusBar!\n");
return -1;
}
if( !m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
CBRS_TOOLTIPS) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME) )
{
TRACE0("Failed To Create ToolBar!\n");
return -1;
}
ASSERT( ::IsWindow(m_wndStatusBar.GetSafeHwnd()) ); // OK Here
ASSERT( ::IsWindow(m_wndToolBar.GetSafeHwnd()) ); // OK Too Here
// 工具栏显示文字,图像为32x32
int nCount = m_wndToolBar.GetCount();
for( int i=0; i<nCount; i++ )
{
UINT uID = m_wndToolBar.GetItemID(i);
CString strText;
if( !strText.LoadString(uID) )
continue;
int nPos = strText.Find(_T('\n'));
if( nPos < 0 )
continue;
strText = strText.Right(strText.GetLength() - nPos - 1);
m_wndToolBar.SetButtonText(i, strText);
}
CRect rcButton;
m_wndToolBar.GetItemRect(0, &rcButton);
m_wndToolBar.SetSizes(rcButton.Size(), CSize(32,32));
return 0;
}