📄 mainreba.cpp
字号:
// MainRebar.cpp: implementation of the CMainRebar class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MainRebar.h"
#include "resource.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
////////////////////////////////////////////////////////////////
// CMainRebar
//
IMPLEMENT_DYNAMIC(CMainRebar, CCoolBar)
////////////////////////////////////////////////////////////////
// This is the virtual function you have to override to add bands
//
BOOL CMainRebar::OnCreateBands()
{
CSize szMin;
if (!m_navToolBar.Create(this, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
CBRS_TOOLTIPS|CBRS_SIZE_DYNAMIC|CBRS_FLYBY|CBRS_ORIENT_HORZ) ||
!m_navToolBar.LoadToolBar(IDR_HOTBAR))
{
TRACE0("Failed to toolbar\n");
return -1; // fail to create
}
// use transparent so coolbar bitmap will show through
m_navToolBar.ModifyStyle(0, TBSTYLE_TRANSPARENT);
CString str;
CImageList imageList;
CBitmap bitmap;
// Create and set the normal toolbar image list.
bitmap.LoadBitmap(IDB_TOOLBAR_COLD);
imageList.Create(36, 44, ILC_COLORDDB|ILC_MASK, 13, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_navToolBar.SetImageList(imageList.m_hImageList);
imageList.Detach();
bitmap.Detach();
// Create and set the hot toolbar image list.
bitmap.LoadBitmap(IDB_TOOLBAR_HOT);
imageList.Create(36, 44, ILC_COLORDDB|ILC_MASK, 13, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_navToolBar.SetHotImageList(imageList.m_hImageList);
imageList.Detach();
bitmap.Detach();
SetColors(::GetSysColor(COLOR_BTNTEXT), ::GetSysColor(COLOR_3DFACE));
// add dropdown button.
// Get minimum size of toolbar, which is basically size of one button
CSize szHorz = m_navToolBar.CalcDynamicLayout(-1, LM_HORZ); // get min horz size
CRect rcNav;
m_navToolBar.GetItemRect(0, &rcNav);
szMin = CSize( szHorz.cx+1, rcNav.Height());
// create toolbar band. Use largest size possible
if (!InsertBand(&m_navToolBar, szMin, 0x7fff, NULL, -1, TRUE))
return FALSE;
bitmap.LoadBitmap(IDB_TOOLBARBKMAP);
SetBackgroundBitmap(&bitmap);
bitmap.Detach();
return TRUE; // OK
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -