123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #pragma once
- #include "HeaderCtrlCl.h"
- // CListCtrlCl
- #define WM_MY_BTN ( WM_USER+1000 )
- enum ITEMTYPE
- {
- TYPE_EDIT=1,
- TYPE_BTN=2,
- TYPE_COMB=3
- };
- class CListCtrlCl : public CListCtrl
- {
- DECLARE_DYNAMIC(CListCtrlCl)
- public:
- CHeaderCtrlCl m_Header;
- CListCtrlCl();
- virtual ~CListCtrlCl();
- protected:
- DECLARE_MESSAGE_MAP()
- virtual void PreSubclassWindow();
- public:
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
- public:
- afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
- void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
- public:
- // 行高
- int m_nRowHeight;
- int InsertColumn(int nCol, LPCTSTR lpszColumnHeading,
- int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1);
- public:
- // Gradient - 渐变系数,立体背景用,不用渐变设为0
- void SetHeaderBKColor(int R, int G, int B, int Gradient);
- public:
- // 设置表头高度
- void SetHeaderHeight(float Height);
- CPtrList m_ptrListCol; //保存列颜色
- CPtrList m_ptrListItem; //保存Item颜色表
- CPtrList m_colTextColor; //保存列字体颜色
- CPtrList m_ItemTextColor; //保存单元格字体颜色
- bool FindColColor(int col ,COLORREF &color); //查找列颜色
- bool FindItemColor(int col,int row,COLORREF &color);
- bool FindColTextColor(int col,COLORREF &color); //查找列字体颜色
- bool FindItemTextColor(int col,int row,COLORREF &color);
- void SetColColor(int col,COLORREF color); //设置列颜色
- void SetItemColor(int col,int row,COLORREF color); //设置Item颜色
- void SetColTextColor(int col,COLORREF color); //设置列文本颜色
- void SetItemTextColor(int col,int row,COLORREF color);
- void SetRowHeigt(int nHeight); //设置行高
- void SetHeaderFontHW(int nHeight,int nWith); //设置表头字体大小
- void SetHeaderTextColor(COLORREF color);
- COLORREF m_color;
- BOOL SetTextColor(COLORREF cr);
- void SetFontHW(int nHeight,int nWith); //设置字体的高和宽
- public:
- // 字体高度
- int m_fontHeight;
- public:
- // 字体宽度
- int m_fontWith;
- afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult);
- CRITICAL_SECTION m_SECTION;
- /////////////////////////////////////////新增//////////////////////////////////////////////////
- public:
- CEdit m_edit;//编辑框控件
- //m_nRow,m_nCol为点击的行号与列号,m_nRowOld,m_nColOld为前一点点击行号与列号
- int m_nRow,m_nCol,m_nRowOld,m_nColOld;
- void Edit();//自定义的编辑函数
- void EndEdit();//自定义的结束编辑函数
- CButton m_Btn;
- void Btn();
- void EndBtn();
- CComboBox m_Comb;
- CStringArray m_saCombData[100];
- void Comb();
- void EndComb();
- void EndAll();
- // Attributes
- private:
- int m_nRowMin,m_nRowMax;
- int m_nColMin,m_nColMax;
- // Operations
- public:
- int m_nItemType[100];
- void SetItemType( int iCol,int iType );
- void SetRange( int iRowMin,int iRowMax,int iColMin,int iColMax );
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- protected:
- virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
- public:
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- // afx_msg void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct);
- afx_msg void OnLvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult);
- };
|