lbxviewtestview.cpp

来自「Visual_C++[1].NET_Bible1 Visual_C++宝典书中」· C++ 代码 · 共 121 行

CPP
121
字号
// LbxViewTestView.cpp : implementation of the CLbxViewTestView class
//

#include "stdafx.h"
#include "LbxViewTest.h"

#include "LbxViewTestDoc.h"
#include "LbxViewTestView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CLbxViewTestView

IMPLEMENT_DYNCREATE(CLbxViewTestView, CListBoxView)

BEGIN_MESSAGE_MAP(CLbxViewTestView, CListBoxView)
	//{{AFX_MSG_MAP(CLbxViewTestView)
		// 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, CListBoxView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CListBoxView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CListBoxView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLbxViewTestView construction/destruction

CLbxViewTestView::CLbxViewTestView()
{
	// TODO: add construction code here

}

CLbxViewTestView::~CLbxViewTestView()
{
}

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

	return CListBoxView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CLbxViewTestView drawing

void CLbxViewTestView::OnDraw(CDC* pDC)
{
	CLbxViewTestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CLbxViewTestView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CLbxViewTestView diagnostics

#ifdef _DEBUG
void CLbxViewTestView::AssertValid() const
{
	CListBoxView::AssertValid();
}

void CLbxViewTestView::Dump(CDumpContext& dc) const
{
	CListBoxView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CLbxViewTestView message handlers

void CLbxViewTestView::OnInitialUpdate() 
{
 CListBoxView::OnInitialUpdate();
	
 CListBox* pLbx = (CListBox*)this;
 if (pLbx)
 {
  CString str;
  for (int i = 0; i < 10; i++)
  {
   str.Format("Test %ld", i);
   pLbx->AddString(str);
  }
 }	
}

⌨️ 快捷键说明

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