📄 zcommandbar.cpp
字号:
// zCommandBar.cpp: implementation of the zCommandBar class.
//
//////////////////////////////////////////////////////////////////////
#include "../stdafx.h"
#include "zCommandBar.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
zCommandBar::zCommandBar()
{
m_hWndCB = NULL;
m_nBarup = 1;
m_hInst = NULL;
m_nUserBitmap = 0;
}
zCommandBar::~zCommandBar()
{
DestoryBar();
}
int zCommandBar::CreateBar(HINSTANCE hInst,HWND hParent,int nMenuId)
{
m_hInst = hInst;
DestoryBar();
SHMENUBARINFO mbi;
memset(&mbi, 0, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hParent;
mbi.nToolBarId = nMenuId;
mbi.hInstRes = hInst;
mbi.nBmpId = 0;
mbi.cBmpImages = 0;
if (!SHCreateMenuBar(&mbi))
return NULL;
m_hWndCB = mbi.hwndMB;
return 1;
}
int zCommandBar::DestoryBar()
{
if (m_hWndCB)
{
CommandBar_Destroy(m_hWndCB);
m_hWndCB=NULL;
return 1;
}
return 0;
}
int zCommandBar::ShowBar(int show)
{
switch(show)
{
case 0:
m_nBarup = 0;
CommandBar_Show(m_hWndCB,FALSE);
break;
case 1:
m_nBarup = 1;
CommandBar_Show(m_hWndCB,TRUE);
break;
case 2:
m_nBarup = 1- m_nBarup;
CommandBar_Show(m_hWndCB,m_nBarup);
break;
default:
return 0;
}
return 0;
}
int zCommandBar::BarHeight()
{
return CommandBar_Height(m_hWndCB);
}
int zCommandBar::AddMenu(int nMenuId)
{
CommandBar_InsertMenubarEx(m_hWndCB,m_hInst,MAKEINTRESOURCE(nMenuId),0);
return 1;
}
int zCommandBar::AddBitmapSys()
{
CommandBar_AddBitmap(m_hWndCB, HINST_COMMCTRL, IDB_STD_SMALL_COLOR, 15, 16, 16);
CommandBar_AddBitmap(m_hWndCB, HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR,12, 16, 16);
m_nUserBitmap = 27;
return 1;
}
int zCommandBar::AddBitmap(int nToolbarId,int nNum)
{
return CommandBar_AddBitmap(m_hWndCB,m_hInst,nToolbarId,nNum,16,17); //添加位图
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -