📄 coolbar.h
字号:
/////////////////////////////////////////////////////////////
//CCoolBar工具条
//功能:取代主窗口菜单和工具条, 可以用图片或渐变色作为背景。
// CAlphalToolBar 平面工具条类
// CMenuBar XP菜单类
//
//创建例子:
//Step1:
// if(!m_wndReBar.CreateEx(this,IDR_MAINFRAME,
// IDR_MAINFRAME, RGB(227,231, 251), RGB(128,168,234)))
// {
// TRACE0("Failed to create rebar\n");
// return -1; // fail to create
// }
//Step2 禁止创建原工具条
// if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
// !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
// {
// TRACE0("Failed to create toolbar\n");
// return -1; // fail to create
// }
// m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
// EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndToolBar);
//
//Step3:
//BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
//{
// if(!m_wndReBar.PreMenuMessage(pMsg))
// return FALSE;
// return CFrameWnd::PreTranslateMessage(pMsg);
//}
//
///////////////////////////////////////////////////////////////
#if !defined(AFX_COOLBAR_H__A1DCDE2A_90B3_47FC_89B4_B6B628E09A55__INCLUDED_)
#define AFX_COOLCTRL_H__A1DCDE2A_90B3_47FC_89B4_B6B628E09A55__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CoolBar.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CCoolCtrl window
#include "MenuBar.H"
#include "AlphaToolBar.H"
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
/*
#define PREMENUMESSAGE(x, y) ( \
if ((x->message == WM_SYSKEYDOWN && x->wParam == VK_MENU) || \
(x->message == WM_KEYUP && x->wParam == VK_MENU) || \
(x->message == WM_ACTIVATE) || \
(x->message == WM_MENUCHAR) || \
(x->message == WM_SETTINGCHANGE) || \
(x->message == WM_SYSCOMMAND)) )
#define IsMenuMessage(x) ( \
((x->message == WM_SYSKEYDOWN && x->wParam == VK_MENU) || \
(x->message == WM_KEYUP && x->wParam == VK_MENU) || \
(x->message == WM_ACTIVATE) || \
(x->message == WM_MENUCHAR) || \
(x->message == WM_SETTINGCHANGE) || \
(x->message == WM_SYSCOMMAND)) )
*/
class CCoolBar //: public CReBar
{
// Construction
public:
CCoolBar();
CAlphaToolBar m_wndToolBar;
CMenuBar m_wndMenuBar;
BOOL m_bMenu;
BOOL m_bTool;
HBITMAP m_hBitmap;
CReBar m_BaseBar;
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCoolCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
// static BOOL IsMenuMessage(MSG *pMsg);
//处理主窗口菜单相关信息
//此函数必须加在主窗口中
BOOL PreMenuMessage(MSG* pMsg);
//渐变色背景
BOOL CreateEx(CWnd *pWnd,
UINT nMenuID,
UINT nToolID,
COLORREF clrFore,
COLORREF clrBack,
UINT nHeight = 45,
UINT nID = AFX_IDW_TOOLBAR);
//图片背景
BOOL CreateEx(CWnd *pWnd,
UINT nMenuID,
UINT nToolID,
CBitmap *pBitmap,
UINT nID = AFX_IDW_TOOLBAR);
BOOL CreateGradientBMP(CBitmap* pBitmap, int nDir, COLORREF cl, COLORREF cm, COLORREF cr);
HBITMAP CreateBmp(DWORD dwWidth, DWORD dwHeight,
COLORREF clrFore,
COLORREF clrBack,
UINT shadeID);
HBITMAP CreateBmp2(COLORREF cl1,
COLORREF cl2, int nWidth,
int nHeight, int nDir = 0,
int nNumColors = 255);
HBITMAP CreateBmp3(DWORD dwWidth, DWORD dwHeight,
COLORREF clrFore,
COLORREF clrBack);
COLORREF BlendColors(COLORREF crA, COLORREF crB, float fAmountA);
virtual ~CCoolBar();
// Generated message map functions
protected:
//{{AFX_MSG(CCoolBar)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
// DECLARE_MESSAGE_MAP()
// DECLARE_DYNAMIC(CReBar)
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COOLCTRL_H__A1DCDE2A_90B3_47FC_89B4_B6B628E09A55__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -