ahnenvw.cpp

来自「API经典入门」· C++ 代码 · 共 73 行

CPP
73
字号
// ahnenvw.cpp : implementation file
//

#include "stdafx.h"
#include "tree.h"
#include "ahnenvw.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAhnenView

IMPLEMENT_DYNCREATE(CAhnenView, CView)

CAhnenView::CAhnenView()
{
}

CAhnenView::~CAhnenView()
{
}

CAhnenDoc* CAhnenView::GetDocument()
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAhnenDoc)));
	return (CAhnenDoc*)m_pDocument;
}

// **** we put the following Message Map in here
BEGIN_MESSAGE_MAP(CAhnenView, CView)
	//{{AFX_MSG_MAP(CAhnenView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CAhnenView drawing

void CAhnenView::OnDraw(CDC* pDC)
{
	CAhnenDoc* pDoc = GetDocument();
	CString temp; 
	// determining text height
	int offset = 2*(pDC->GetTextExtent("Wyig", 4)).cy; 
	
	for (int i = 0; i < pDoc->m_arrAhnentafel.GetSize(); i++)
	{
		_itoa(i+1, temp.GetBuffer(20), 10);
		temp.ReleaseBuffer();
		pDC->TextOut(5, offset*i, temp);
		pDC->TextOut(50,offset*i, pDoc->m_arrAhnentafel[i]);
	}
}

/////////////////////////////////////////////////////////////////////////////
// Printing support

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

/////////////////////////////////////////////////////////////////////////////
// CAhnenView message handlers
 

⌨️ 快捷键说明

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