listctrlcommon.cpp

来自「UHF RFID Reader Program」· C++ 代码 · 共 37 行

CPP
37
字号
#include "stdafx.h"
#include "ListCtrlCommon.h"

CListCtrlCommon::CListCtrlCommon()
{
}

CListCtrlCommon::~CListCtrlCommon()
{
}

BOOL CListCtrlCommon::AddItem(int nItem, int nSubItem, LPCWSTR strItem, int mask)
{
	LV_ITEM         lvitem;
	CString			szText;

	memset(&lvitem,0,sizeof(LV_ITEM));
	lvitem.mask = mask;
	lvitem.iItem = nItem;
	lvitem.iSubItem = nSubItem;
	lvitem.pszText = szText.GetBuffer(_tcslen(strItem));
	_tcscpy(lvitem.pszText,(LPCTSTR)strItem);

	if (nSubItem == 0)
	{
		if(InsertItem(&lvitem) == -1) // insert new item
			return false; 
	}
//	else
		return(SetItem(&lvitem)); // modify existing item (the sub-item text)}
}

BOOL CListCtrlCommon::AddColumn(int nItem, LPCWSTR strItem, int width, int nFmt, int nSubItem, int nMask)
{
	return(InsertColumn(nItem, (LPCTSTR)strItem, nFmt, width, nSubItem)!=-1?true:false);
}

⌨️ 快捷键说明

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