www.gusucode.com > VC++三子棋游戏源码(类似五子棋)-源码程序 > VC++三子棋游戏源码(类似五子棋)-源码程序\code\userlistview.cpp

    //Download by http://www.NewXing.com
// userlistview.cpp : implementation file
//

#include "stdafx.h"
#include "SanQi.h"
#include "userlistview.h"

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

/////////////////////////////////////////////////////////////////////////////
// CUserListView
extern CSanQiApp		theApp;
extern CFaceList*		gpFaceList;

IMPLEMENT_DYNCREATE(CUserListView, CListView)

CUserListView::CUserListView()
{
	pUserInfoList	=NULL;
	pFaceImgList	=NULL;
}

CUserListView::~CUserListView()
{
	SAFE_CHECKPOINTER(pUserInfoList)
	{
		delete pUserInfoList;
		pUserInfoList	=NULL;
	}
}


BEGIN_MESSAGE_MAP(CUserListView, CView)
	//{{AFX_MSG_MAP(CUserListView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUserListView drawing

void CUserListView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CUserListView diagnostics

#ifdef _DEBUG
void CUserListView::AssertValid() const
{
	CView::AssertValid();
}

void CUserListView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CUserListView message handlers
void CUserListView::OnInitialUpdate() 
{
	CListView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	
	//GetListCtrl().InsertColumn(
	CListCtrl& theCtrl = GetListCtrl();	
	theCtrl.InsertColumn(0,"战斗时间",LVCFMT_CENTER,60);
	theCtrl.InsertColumn(0,"战斗次数",LVCFMT_CENTER,60);
	theCtrl.InsertColumn(0,"职位",LVCFMT_CENTER,40);
	theCtrl.InsertColumn(0,"门派",LVCFMT_CENTER,40);
	theCtrl.InsertColumn(0,"和",LVCFMT_CENTER,30);
	theCtrl.InsertColumn(0,"输",LVCFMT_CENTER,30);
	theCtrl.InsertColumn(0,"赢",LVCFMT_CENTER,30);
	theCtrl.InsertColumn(0,"积分",LVCFMT_CENTER,40);
	theCtrl.InsertColumn(0,"级别",LVCFMT_CENTER,40);
	theCtrl.InsertColumn(0,"财富",LVCFMT_CENTER,40);
	theCtrl.InsertColumn(0,"网速",LVCFMT_CENTER,40);
	theCtrl.InsertColumn(0,"中文名",LVCFMT_CENTER,50);
	theCtrl.InsertColumn(0,"用户名",LVCFMT_CENTER,50);
	theCtrl.InsertColumn(0,"",LVCFMT_CENTER,0);

	DWORD dwStype=GetWindowLong(theCtrl.GetSafeHwnd(),GWL_STYLE);
	dwStype&=~LVS_TYPEMASK;		//Remove the current stype flags
	dwStype|=LVS_REPORT;		//Add the List stype
	SetWindowLong(theCtrl.GetSafeHwnd(),GWL_STYLE,dwStype);	//Set it back into the list view
	
	SAFE_CHECKPOINTER(gpFaceList)
	{
		if(NULL == pFaceImgList)
		{
			pFaceImgList	=gpFaceList->GetImageList4();
		}
	}
	SAFE_CHECKPOINTER(pFaceImgList)
	{
		theCtrl.SetImageList(pFaceImgList,LVSIL_SMALL);
		int	nCount	=pFaceImgList->GetImageCount();
	}

	SetRedraw(true);
}