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

📄 readme.wzd

📁 《Visual C++ MFC编程实例》配套代码,如果大家正在学习此教程
💻 WZD
字号:
/////////////////////////////////////////////////////////////////////
// Example files.
/////////////////////////////////////////////////////////////////////

WzdInfo.cpp -- a sample data class which holds the string value of
WzdInfo.h		each column in a list control's line

/////////////////////////////////////////////////////////////////////
// Modify the class that owns the list control.
/////////////////////////////////////////////////////////////////////


// 1) add the data class as a data item to each list entry in the list control
	m_ctrlList.SetItemData(0,(DWORD)new CWzdInfo("Bill","Smith"));


// 2) use ClassWizard to add a LVN_COLUMNCLICK handler for this list control
void CWzdDialog::OnColumnclickWzdList(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	m_ctrlList.SortItems( (PFNLVCOMPARE)CompareColumnItems, pNMListView->iSubItem );
	*pResult = 0;
}

// 3) define the CompareColumnItems() static function in this class's include file

// 4) implement the static function as seen here
int CALLBACK CompareColumnItems( CWzdInfo* pItem1, CWzdInfo* pItem2, LPARAM lCol )
{
	int nCmp = 0;
	switch( lCol )
	{
	case 0: //column 1
		nCmp = pItem1->m_sFirst.CompareNoCase( pItem2->m_sFirst );
		break;
	case 1: //column 2
		nCmp = pItem1->m_sLast.CompareNoCase( pItem2->m_sLast );
		break;
	}
	return nCmp;
}

// 5) destroy these data classes when the list control is destroyed
void CWzdDialog::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// destroy all data items
	int i=0;
	while(i<m_ctrlList.GetItemCount())
	{
		delete (CWzdInfo *)m_ctrlList.GetItemData(i++);
	}
}


/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1998 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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