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

📄 listerview.cpp

📁 讲mfc的书
💻 CPP
字号:
// listerView.cpp : implementation of the CListerView class
//

#include "stdafx.h"
#include "lister.h"

#include "listerDoc.h"
#include "listerView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CListerView

IMPLEMENT_DYNCREATE(CListerView, CFormView)

BEGIN_MESSAGE_MAP(CListerView, CFormView)
	//{{AFX_MSG_MAP(CListerView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CListerView construction/destruction

CListerView::CListerView()
	: CFormView(CListerView::IDD)
{
	//{{AFX_DATA_INIT(CListerView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CListerView::~CListerView()
{
}

void CListerView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CListerView)
	DDX_Control(pDX, IDC_LIST1, m_list);
	//}}AFX_DATA_MAP
}

BOOL CListerView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CListerView printing

BOOL CListerView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CListerView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CListerView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

void CListerView::OnPrint(CDC* pDC, CPrintInfo*)
{
	// TODO: add code to print the controls
}

/////////////////////////////////////////////////////////////////////////////
// CListerView diagnostics

#ifdef _DEBUG
void CListerView::AssertValid() const
{
	CFormView::AssertValid();
}

void CListerView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CListerDoc* CListerView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CListerDoc)));
	return (CListerDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CListerView message handlers

void CListerView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	m_list.InsertColumn(0,"Name", LVCFMT_LEFT,100);
	m_list.InsertColumn(1,"e-mail", LVCFMT_LEFT, 100,1);
	m_list.InsertItem(0,"Al Williams");
	m_list.SetItem(0,1,LVIF_TEXT,"alw@al-williams.com",-1,0,0,0);
	m_list.InsertItem(1,"Pat Williams");
	m_list.SetItem(1,1,LVIF_TEXT,"pat@al-williams.com",-1,0,0,0);
}

⌨️ 快捷键说明

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