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

📄 colmsglist.cpp

📁 symbian手机短信报警
💻 CPP
字号:
// ColMsgList.cpp : implementation file
//

#include "stdafx.h"
#include "MsgDemo.h"
#include "ColMsgList.h"

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

/////////////////////////////////////////////////////////////////////////////
// CColMsgList

CColMsgList::CColMsgList()
{
}

CColMsgList::~CColMsgList()
{
}


BEGIN_MESSAGE_MAP(CColMsgList, CListCtrl)
	//{{AFX_MSG_MAP(CColMsgList)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColMsgList message handlers



void CColMsgList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	// TODO: Add your code to draw the specified item
	int flag2;
	flag2=(lpDrawItemStruct->itemID%2==0)?0:1;
	CBrush brush;
	int width0,width1,width2,width3,width4;
	CDC* mydc;
	mydc=CDC::FromHandle(lpDrawItemStruct->hDC);
	RECT tmprect;
	tmprect.top=lpDrawItemStruct->rcItem.top;
	tmprect.bottom=lpDrawItemStruct->rcItem.bottom;
	CString CS_00=this->GetItemText(lpDrawItemStruct->itemID,0);
	width0=this->GetColumnWidth(0);
	tmprect.left=lpDrawItemStruct->rcItem.left;
	tmprect.right=lpDrawItemStruct->rcItem.left+width0;
	if(flag2==0)
	{
		brush.CreateSolidBrush(RGB(233,233,193));
		mydc->SetTextColor(RGB(0,0,0));
	}
	else
	{
		brush.CreateSolidBrush(RGB(161,236,209));
		mydc->SetTextColor(RGB(0,0,0));
	}
	mydc->FillRect(&lpDrawItemStruct->rcItem,&brush);
	brush.DeleteObject();

	mydc->TextOut(2+lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top,CS_00);

	CString CS_01=this->GetItemText(lpDrawItemStruct->itemID,1);
	width1=this->GetColumnWidth(1);
	tmprect.left=lpDrawItemStruct->rcItem.left+width0;
	tmprect.right=lpDrawItemStruct->rcItem.left+width0+width1;
	mydc->TextOut(2+lpDrawItemStruct->rcItem.left+width0,lpDrawItemStruct->rcItem.top,CS_01);

	CString CS_02=this->GetItemText(lpDrawItemStruct->itemID,2);
	width2=this->GetColumnWidth(2);
	tmprect.left=lpDrawItemStruct->rcItem.left+width0+width1;
	tmprect.right=lpDrawItemStruct->rcItem.left+width0+width1+width2;
	mydc->TextOut(2+lpDrawItemStruct->rcItem.left+width0+width1,lpDrawItemStruct->rcItem.top,CS_02);

	CString CS_03=this->GetItemText(lpDrawItemStruct->itemID,3);
	width3=this->GetColumnWidth(3);
	tmprect.left=lpDrawItemStruct->rcItem.left+width0+width1+width2;
	tmprect.right=lpDrawItemStruct->rcItem.left+width0+width1+width2+width3;
	mydc->TextOut(2+lpDrawItemStruct->rcItem.left+width0+width1+width2,lpDrawItemStruct->rcItem.top,CS_03);

	CString CS_04=this->GetItemText(lpDrawItemStruct->itemID,4);
	width4=this->GetColumnWidth(4);
	tmprect.left=lpDrawItemStruct->rcItem.left+width0+width1+width2+width3;
	tmprect.right=lpDrawItemStruct->rcItem.left+width0+width1+width2+width3+width4;
	mydc->TextOut(2+lpDrawItemStruct->rcItem.left+width0+width1+width2+width3,lpDrawItemStruct->rcItem.top,CS_04);
}

⌨️ 快捷键说明

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