www.pudn.com > MFCVista.rar > IComboBox.h


#pragma once 
 
 
// ZREdit 
#include "imagelist.h" 
#include "Iontrlpos.h" 
//使用1*3的图片资源 
class AFX_EXT_CLASS CIComboBox : public CComboBox,public CIontrlPos,private CImageListEx 
{ 
	DECLARE_DYNAMIC(CIComboBox) 
public:	 
	CIComboBox(); 
	virtual ~CIComboBox(); 
 
protected: 
	DECLARE_MESSAGE_MAP() 
protected: 
	CString		m_strItemText; 
	int			m_iIndex, 
				m_iOldIndex; 
	bool		m_bMouseDown; 
	CRect		m_CRect; 
	CPoint		m_CPointCursor; 
	bool		m_bReadOnly; 
	CFont		m_fntSys; 
	int			m_iListHeight; 
	CEdit		*m_pEditCtrl; 
	CIontrlPos	m_posEditCtrl; 
	CBitmap		m_bmpBackground; 
	BITMAP		m_infBackground; 
public: 
	afx_msg void OnTimer(UINT nIDEvent); 
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 
	afx_msg BOOL OnEraseBkgnd(CDC* pDC); 
	afx_msg void OnCbnCloseup(); 
	afx_msg void OnCbnDropdown(); 
	afx_msg void OnPaint();	 
public: 
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 
	virtual BOOL PreTranslateMessage(MSG* pMsg); 
	virtual void MouseMove(bool bMouseIn);//当鼠标在控件的小图表上移动的时候 
	virtual void PreSubclassWindow(); 
	virtual void SetAttributeDC(CDC *pDC,LPDRAWITEMSTRUCT lpDrawItemStruct); 
	virtual void DrawBackGround(CDC *pDC,LPDRAWITEMSTRUCT lpDrawItemStruct); 
	virtual void DrawBackGround(CDC *pDC); 
	virtual void DrawItemText(CDC *pDC,LPDRAWITEMSTRUCT lpDrawItemStruct); 
	virtual CString GetText(LPDRAWITEMSTRUCT lpDrawItemStruct);//精简文字 
	virtual void MeasureItem(LPMEASUREITEMSTRUCT); 
public: 
	COLORREF	m_clrBackGround, 
				m_clrRect, 
				m_clrTextColor; 
	void		SetWidth(int w); 
	void		SetReadOnly(bool bReadOnly=1); 
	void		SetBold(bool bBold=1); 
	void		SetAtt(UINT image,UINT nIDRes,bool bReadOnly=0,bool bBold=0,COLORREF textclr=RGB(0,40,0),COLORREF bkclr=RGB(255,255,255),COLORREF rectclr=RGB(104,137,166)); 
	CEdit		&GetEditCtrl(); 
	int			GetStringInsIndex(LPCTSTR lpszString); 
	void		SetItemColor(int iItem,COLORREF clrText); 
	COLORREF	GetItemColor(int iItem); 
	int			AddString(LPCTSTR lpszString,COLORREF clrText=0); 
	int			FindString(int nStartAfter,LPCTSTR lpszString,bool bAllMatch=0); 
};