📄 toolbarex.cpp
字号:
// ToolBarEx.cpp: implementation of the CToolBarEx class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "USBISP.h"
#include "ToolBarEx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CToolBarEx::CToolBarEx()
{
sizeImage.cx =32;//默认图片大小为20X20
sizeImage.cy =40;
img.Create(sizeImage.cx-1, sizeImage.cy-1, ILC_COLOR8|ILC_MASK, 1,1);
}
CToolBarEx::~CToolBarEx()
{
}
void CToolBarEx::SetImage()
{
this->GetToolBarCtrl().SetImageList (&img);
}
void CToolBarEx::SetButtonNumber(int n)
{
SetButtons(NULL,n);
}
void CToolBarEx::SetButton(int nButton, int nID, int nImage,LPTSTR lpText)
{
SetButtonInfo(nButton, nID, TBSTYLE_BUTTON, nImage);
SetButtonText(nButton, lpText);
}
void CToolBarEx::SetButton(int nButton, int nID, int nImage)
{
SetButtonInfo(nButton, nID, TBSTYLE_BUTTON, nImage);
}
void CToolBarEx::SetSize(int nWidth,int nHeight)
{
CSize cs;
cs.cx =nWidth;
cs.cy =nHeight;
SetSizes(cs, sizeImage);
}
void CToolBarEx::AddIcon(HICON hIcon)
{
img.Add (hIcon);
SetImage();
}
void CToolBarEx::AddSeparator(int nButton)
{
SetButtonInfo(nButton, 0, TBBS_SEPARATOR, 0);
}
void CToolBarEx::SetDefaultSize()
{
CRect rectToolBar;
GetItemRect(0, &rectToolBar); //得到按钮的大小
SetSizes(rectToolBar.Size (), sizeImage); //设置按钮的大小
}
void CToolBarEx::AddBitmap(CBitmap *pbmImage, CBitmap *pbmMask)
{
img.Add( pbmImage, pbmMask);
SetImage();
}
void CToolBarEx::AddBitmap(CBitmap *pbmImage, COLORREF crMask)
{
img.Add( pbmImage, crMask);
SetImage();
}
void CToolBarEx::SetImageSize(int nImageWidth,int nImageHeight)
{
sizeImage.cx = nImageWidth;
sizeImage.cy =nImageHeight;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -