?? mytoolbar.cpp
字號:
// MyToolBar.cpp : implementation file
//
#include "stdafx.h"
#include "ZCR14Paint.h"
//#include "MyPaint.h"
#include "MyToolBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyToolBar
CMyToolBar::CMyToolBar()
{
m_nColumns = 2;
m_rcBorder.top = 3;
m_rcBorder.bottom = 3;
m_rcBorder.left = 9;
m_rcBorder.right = 20;
}
CMyToolBar::~CMyToolBar()
{
}
BEGIN_MESSAGE_MAP(CMyToolBar, CToolBar)
//{{AFX_MSG_MAP(CMyToolBar)
ON_WM_NCPAINT()
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyToolBar message handlers
void CMyToolBar::SetColumns(UINT nColumns)
{
SetBorders(m_rcBorder);
m_nColumns = nColumns;
int nCount = GetToolBarCtrl().GetButtonCount();
for(int i=0;i < nCount;i++)
{
UINT nStyle = GetButtonStyle(i);
BOOL bWrap = (((i+1)%nColumns)==0);
if(bWrap)
nStyle |= TBBS_WRAPPED;
else
nStyle &= ~TBBS_WRAPPED;
SetButtonStyle(i,nStyle);
}
GetParentFrame()->RecalcLayout();
}
void CMyToolBar::OnPaint()
{
CToolBar::OnPaint();
// TODO: Add your message handler code here
CWindowDC dc(this); // device context for painting
m_Option.Draw(&dc);
// Do not call CToolBar::OnPaint() for painting messages
}
void CMyToolBar::OnNcPaint()
{
// TODO: Add your message handler code here
SetColumns(2);
CControlBar::EraseNonClient();
CRect rect;
GetClientRect( &rect );
InvalidateRect( &rect, FALSE );
// Do not call CToolBar::OnNcPaint() for painting messages
}
void CMyToolBar::SetSelType(SELTYPE type)
{
m_Option.SetOptionType(type);
Invalidate();
}
void CMyToolBar::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
point.y += m_rcBorder.left;
if ( m_Option.PointToOption(point) )
Invalidate();
CToolBar::OnLButtonDown(nFlags, point);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -