15,979
社区成员
发帖
与我相关
我的任务
分享
#if !defined(AFX_LISTCTRLCL2_H__2CA60ECC_6A27_4FBD_8D9C_D01B2ACBBF3F__INCLUDED_)
#define AFX_LISTCTRLCL2_H__2CA60ECC_6A27_4FBD_8D9C_D01B2ACBBF3F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ListCtrlCl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CListCtrlCl window
// CListCtrlCl
#include "HeaderCtrlCl.h"
#include "AddressList.h"
class CListCtrlCl : public CListCtrl
{
//DECLARE_DYNAMIC(CListCtrlCl)
public:
CHeaderCtrlCl m_Header;
CListCtrlCl();
virtual ~CListCtrlCl();
public:
// Overrides
// ClassWizard generated virtual function overrides
// Implementation
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_VIRTUAL(CListCtrlCl)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(CListCtrlCl)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYCOLORBUTTON_H__900BAE2E_90AF_4AEF_BF4E_07B7F1AA86ED__INCLUDED_)
.cpp
// ListCtrlCl.cpp : 实现文件
//
#include "stdafx.h"
#include "Addresslist.h"
#include "ListCtrlCl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
struct stColor
{
int nRow;
int nCol;
COLORREF rgb;
};
// CListCtrlCl
CListCtrlCl::CListCtrlCl()
: m_nRowHeight(0)
, m_fontHeight(12)
, m_fontWith(0)
{
m_color = RGB(0,0,0);
}
CListCtrlCl::~CListCtrlCl()
{
}
//IMPLEMENT_DYNAMIC(CListCtrlCl, CListCtrl)
BEGIN_MESSAGE_MAP(CListCtrlCl, CListCtrl)
//{{AFX_MSG_MAP(CListCtrlCl)
ON_WM_LBUTTONDOWN()
ON_WM_MEASUREITEM()
ON_WM_MEASUREITEM_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*BEGIN_MESSAGE_MAP(CListCtrlCl, CListCtrl)
ON_WM_MEASUREITEM()
ON_WM_MEASUREITEM_REFLECT()
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()*/
...还有一些函数实现没添出来