mylist.cpp

来自「一个简易的医药销售管理系统源码」· C++ 代码 · 共 81 行

CPP
81
字号
// MyList.cpp : implementation file
//

#include "stdafx.h"
#include "MyList.h"
#include ".\mylist.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyList

CMyList::CMyList()
{

}

CMyList::~CMyList()
{
}


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

void CMyList::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 CMyList::SetItemColor(DWORD iItem, COLORREF color)
{
	//	m_iCurrentItem = iItem;
	//	m_CurrentColor = color;
	
	MapItemColor.SetAt(iItem, color);
	this->RedrawItems(iItem, iItem);
	UpdateWindow();
	
}

/////////////////////////////////////////////////////////////////////////////
// CMyList message handlers

void CMyList::WinHelp(DWORD dwData, UINT nCmd)
{
}

⌨️ 快捷键说明

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