VC++实现工具栏上添加平面组合框控件(2)
三、程序代码
//////////////////////////////////////////////////////////////////////////////
// FlatComboBox.h : header file
#if !defined(FLATCOMBOBOX_H_INCLUDED)
#define FLATCOMBOBOX_H_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define FC_DRAWNORMAL 0x00000001
#define FC_DRAWRAISED 0x00000002
#define FC_DRAWPRESSD 0x00000004
// CFlatComboBox window
class CFlatComboBox : public CComboBox
{
// Construction
public:
CFlatComboBox();
// Attributes
public:
bool m_bLBtnDown;
COLORREF m_clrHilite;
COLORREF m_clrShadow;
COLORREF m_clrDkShad;
COLORREF m_clrButton;
// Operations
public:
void DrawCombo(DWORD dwStyle, COLORREF clrTopLeft, COLORREF clrBottomRight);
int Offset();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFlatComboBox)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFlatComboBox();
// Generated message map functions
protected:
//{{AFX_MSG(CFlatComboBox)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // !defined(FLATCOMBOBOX_H_INCLUDED)
///////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "FlatComboBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif