ListCtrlCl.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #pragma once
  2. #include "HeaderCtrlCl.h"
  3. // CListCtrlCl
  4. #define WM_MY_BTN ( WM_USER+1000 )
  5. enum ITEMTYPE
  6. {
  7. TYPE_EDIT=1,
  8. TYPE_BTN=2,
  9. TYPE_COMB=3
  10. };
  11. class CListCtrlCl : public CListCtrl
  12. {
  13. DECLARE_DYNAMIC(CListCtrlCl)
  14. public:
  15. CHeaderCtrlCl m_Header;
  16. CListCtrlCl();
  17. virtual ~CListCtrlCl();
  18. protected:
  19. DECLARE_MESSAGE_MAP()
  20. virtual void PreSubclassWindow();
  21. public:
  22. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  23. public:
  24. afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  25. void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  26. public:
  27. // 行高
  28. int m_nRowHeight;
  29. int InsertColumn(int nCol, LPCTSTR lpszColumnHeading,
  30. int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1);
  31. public:
  32. // Gradient - 渐变系数,立体背景用,不用渐变设为0
  33. void SetHeaderBKColor(int R, int G, int B, int Gradient);
  34. public:
  35. // 设置表头高度
  36. void SetHeaderHeight(float Height);
  37. CPtrList m_ptrListCol; //保存列颜色
  38. CPtrList m_ptrListItem; //保存Item颜色表
  39. CPtrList m_colTextColor; //保存列字体颜色
  40. CPtrList m_ItemTextColor; //保存单元格字体颜色
  41. bool FindColColor(int col ,COLORREF &color); //查找列颜色
  42. bool FindItemColor(int col,int row,COLORREF &color);
  43. bool FindColTextColor(int col,COLORREF &color); //查找列字体颜色
  44. bool FindItemTextColor(int col,int row,COLORREF &color);
  45. void SetColColor(int col,COLORREF color); //设置列颜色
  46. void SetItemColor(int col,int row,COLORREF color); //设置Item颜色
  47. void SetColTextColor(int col,COLORREF color); //设置列文本颜色
  48. void SetItemTextColor(int col,int row,COLORREF color);
  49. void SetRowHeigt(int nHeight); //设置行高
  50. void SetHeaderFontHW(int nHeight,int nWith); //设置表头字体大小
  51. void SetHeaderTextColor(COLORREF color);
  52. COLORREF m_color;
  53. BOOL SetTextColor(COLORREF cr);
  54. void SetFontHW(int nHeight,int nWith); //设置字体的高和宽
  55. public:
  56. // 字体高度
  57. int m_fontHeight;
  58. public:
  59. // 字体宽度
  60. int m_fontWith;
  61. afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult);
  62. CRITICAL_SECTION m_SECTION;
  63. /////////////////////////////////////////新增//////////////////////////////////////////////////
  64. public:
  65. CEdit m_edit;//编辑框控件
  66. //m_nRow,m_nCol为点击的行号与列号,m_nRowOld,m_nColOld为前一点点击行号与列号
  67. int m_nRow,m_nCol,m_nRowOld,m_nColOld;
  68. void Edit();//自定义的编辑函数
  69. void EndEdit();//自定义的结束编辑函数
  70. CButton m_Btn;
  71. void Btn();
  72. void EndBtn();
  73. CComboBox m_Comb;
  74. CStringArray m_saCombData[100];
  75. void Comb();
  76. void EndComb();
  77. void EndAll();
  78. // Attributes
  79. private:
  80. int m_nRowMin,m_nRowMax;
  81. int m_nColMin,m_nColMax;
  82. // Operations
  83. public:
  84. int m_nItemType[100];
  85. void SetItemType( int iCol,int iType );
  86. void SetRange( int iRowMin,int iRowMax,int iColMin,int iColMax );
  87. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  88. protected:
  89. virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  90. public:
  91. afx_msg void OnKillFocus(CWnd* pNewWnd);
  92. // afx_msg void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct);
  93. afx_msg void OnLvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult);
  94. };