📄 coollistbox.h
字号:
/*####################################################################
Filename: coollistbox.h
----------------------------------------------------
####################################################################*/
#if !defined(_ANYOU_COOLLISTBOX_H)
#define _ANYOU_COOLLISTBOX_H
#if _MSC_VER > 1000
#pragma once
#endif
#include <afxtempl.h>
#include "CoolTipCtrl.h"
/*####################################################################
------------------------------------------------
CListBoxItem class
------------------------------------------------
####################################################################*/
class CListBoxItem
{
friend class CCoolListBox;
private:
CCoolListBox* m_parent;
int m_nImage;
int m_nIndex;
UINT ID;//item ID
CString m_strText;
CString m_strTipText;
DWORD m_dwExState;
DWORD m_dwExStyle;
public:
void SetTipText(LPCTSTR strTipText);
CListBoxItem(int nIndex, int nImage, CString strText, CCoolListBox* parent);
};
#define IDC_UPBUTTON 1689908023
#define IDC_DOWNBUTTON 1689908024
#if !defined(ODS_HOTLIGHT)
#define ODS_HOTLIGHT 0x0040
#endif
/*####################################################################
------------------------------------------------
CCoolListBox class
------------------------------------------------
####################################################################*/
class CCoolListBox : public CListBox
{
// Construction-----------------------------------------
public:
CCoolListBox();
virtual ~CCoolListBox();
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
// Attributes-------------------------------------------
public:
CList<CListBoxItem*, CListBoxItem*> m_aItems;
int m_nHotItem;
int m_nIndex; // currently selected menu index
bool m_bHilight; // true when menu item is selected
bool m_bLBDown; // true when left mouse button is pressed
CPoint m_point; // holds the cursor position
CButton m_wndUpButton;
CButton m_wndDownButton;
CCoolTipCtrl m_wndTipctrl;
CImageList m_imagelist;
// Operations-------------------------------------------
public:
int AddItem(int nImage, LPCTSTR strText,UINT id, LPCTSTR strTipText = "");
BOOL SetImagelist(UINT uBitmap);
// Overrides---------------------------------------------
//{{AFX_VIRTUAL(CCoolListBox)
protected:
//}}AFX_VIRTUAL
// Implementation----------------------------------------
protected:
void ReLocation();
CListBoxItem* GetItem(int nIndex);
// Generated message map functions------------------------
protected:
//{{AFX_MSG(CCoolListBox)
afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDownButton();
afx_msg void OnUpButton();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
#endif // !defined(_ANYOU_COOLLISTBOX_H)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -