textview.cpp

来自「mfc实验例题也是高教得配套资料 刚找到得 这部分应该是自学的内容」· C++ 代码 · 共 84 行

CPP
84
字号
// TextView.cpp : implementation file
//

#include "stdafx.h"
#include "Exp24_1.h"
#include "exp24_1Doc.h"
#include "element.h"

#include "TextView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTextView

IMPLEMENT_DYNCREATE(CTextView, CView)

CTextView::CTextView()
{
}

CTextView::~CTextView()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// CTextView drawing

void CTextView::OnDraw(CDC* pDC)
{
	CExp24_1Doc* pDoc = (CExp24_1Doc*)GetDocument();
	// TODO: add draw code here
	POSITION pos;
	TEXTMETRIC tm;
	pDC->GetTextMetrics(&tm);
	int cy,y = 0;
	cy = tm.tmHeight;
	CElement *elem;
	pos = pDoc->m_elemList.GetHeadPosition();
	while(pos!=NULL){  //画出链表中所有图形
			elem = (CElement*)pDoc->m_elemList.GetAt(pos);
			elem->Show(pDC,y);
			pDoc->m_elemList.GetNext(pos);
			y += cy;
	}
}

/////////////////////////////////////////////////////////////////////////////
// CTextView diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CTextView message handlers

void CTextView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	
}

⌨️ 快捷键说明

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