rccheckcombobox.h

来自「一个COMBOBOX的扩展类」· C头文件 代码 · 共 72 行

H
72
字号
#if !defined(AFX_RCCHECKCOMBOBOX_H__3E042568_B6F5_4D66_8526_7232A529A0E7__INCLUDED_)
#define AFX_RCCHECKCOMBOBOX_H__3E042568_B6F5_4D66_8526_7232A529A0E7__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RcCheckComboBox.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CRcCheckComboBox window

class CRcCheckComboBox : public CComboBox
{
public:
	CRcCheckComboBox();
	virtual ~CRcCheckComboBox();

	BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

	// Set the text show type
	UINT SetShowType(UINT nShowType);

	// Selects all/unselects the specified item
	INT SetCheck(INT nIndex, BOOL bFlag);

	// Returns checked state
	BOOL GetCheck(INT nIndex);

	// Selects all/unselects all
	void SelectAll(BOOL bCheck = TRUE);

protected:
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRcCheckComboBox)
	public:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CRcCheckComboBox)
	afx_msg LRESULT OnCtlColorListBox(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnGetText(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnGetTextLength(WPARAM wParam, LPARAM lParam);
	afx_msg void OnDropdown();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

protected:
	// The subclassed COMBOLBOX window (notice the 'L')
	HWND m_hListBox;

	// The string containing the text to display
	CString m_strText;
	UINT m_nShowType;
	BOOL m_bTextUpdated;

	// A flag used in MeasureItem, see comments there
	BOOL m_bItemHeightSet;

	// Routine to update the text
	void RecalcText();
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RCCHECKCOMBOBOX_H__3E042568_B6F5_4D66_8526_7232A529A0E7__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?