⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myclistctrl.cpp

📁 一个给铁路机车系统采集排气
💻 CPP
字号:
// MyClistCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "test.h"
#include "MyClistCtrl.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyClistCtrl

CMyClistCtrl::CMyClistCtrl()
{
}

CMyClistCtrl::~CMyClistCtrl()
{
}


BEGIN_MESSAGE_MAP(CMyClistCtrl, CListCtrl)
	//{{AFX_MSG_MAP(CMyClistCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnNMCustomdraw)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyClistCtrl message handlers

void CMyClistCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
	*pResult = CDRF_DODEFAULT;
	NMLVCUSTOMDRAW * lplvdr=(NMLVCUSTOMDRAW*)pNMHDR;
	NMCUSTOMDRAW &nmcd = lplvdr->nmcd;
	
	switch(lplvdr->nmcd.dwDrawStage)
	{
	case CDDS_PREPAINT:
			
			*pResult = CDRF_NOTIFYITEMDRAW;
			break;
			
	case CDDS_ITEMPREPAINT:
		{
			COLORREF ItemColor;
			if( MapItemColor.Lookup(nmcd.dwItemSpec, ItemColor))
			{
				lplvdr->clrText = ItemColor;
				*pResult = CDRF_DODEFAULT;
			}
		}
		break;


	}

}

void CMyClistCtrl::SetItemColor(DWORD iItem, COLORREF color)
{
	//	m_iCurrentItem = iItem;
	//	m_CurrentColor = color;
	
	MapItemColor.SetAt(iItem, color);
	this->RedrawItems(iItem, iItem);
	UpdateWindow();
	
}

⌨️ 快捷键说明

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