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

📄 splitview.cpp

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

#include "stdafx.h"
#include "split.h"

#include "splitDoc.h"
#include "splitView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSplitView

IMPLEMENT_DYNCREATE(CSplitView, CScrollView)

BEGIN_MESSAGE_MAP(CSplitView, CScrollView)
	//{{AFX_MSG_MAP(CSplitView)
		// 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
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSplitView construction/destruction

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

}

CSplitView::~CSplitView()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CSplitView drawing

void CSplitView::OnDraw(CDC* pDC)
{
	CSplitDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDC->SetBkMode(TRANSPARENT);
	for (int i=0;i<100;i++)
		{
		CString s;
		s.Format("%d",i);
		pDC->TextOut(0,i*lineht,s);
		}


}

void CSplitView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();
	CSize sizeTotal;
	CDC *dc=GetDC();
	TEXTMETRIC tm;
	dc->GetTextMetrics(&tm);
	lineht=tm.tmHeight+tm.tmExternalLeading;
	ReleaseDC(dc);
	// calculate the total size of this view
	sizeTotal.cx = 640;
	sizeTotal.cy = lineht*100;
	SetScrollSizes(MM_TEXT, sizeTotal);
}

/////////////////////////////////////////////////////////////////////////////
// CSplitView diagnostics

#ifdef _DEBUG
void CSplitView::AssertValid() const
{
	CScrollView::AssertValid();
}

void CSplitView::Dump(CDumpContext& dc) const
{
	CScrollView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CSplitView message handlers

⌨️ 快捷键说明

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