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

📄 cqingx~3.cpp

📁 visual c++ 时尚编程百例 全部源代码
💻 CPP
字号:
// CQingxieTextView.cpp : implementation of the CCQingxieTextView class
//

#include "stdafx.h"
#include "CQingxieText.h"

#include "CQingxieTextDoc.h"
#include "CQingxieTextView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCQingxieTextView

IMPLEMENT_DYNCREATE(CCQingxieTextView, CView)

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

/////////////////////////////////////////////////////////////////////////////
// CCQingxieTextView construction/destruction

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

}

CCQingxieTextView::~CCQingxieTextView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCQingxieTextView drawing

void CCQingxieTextView::OnDraw(CDC* pDC)
{
	CCQingxieTextDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CRect rect;//得到客户区的大小
	GetClientRect(rect);
	CString  str(_T("visual c++6.0 is very good!"));//要显示的字体
	pDC->SetBkMode(TRANSPARENT);
	CFont font;
	LOGFONT stFont;//定义字体格式
	memset(&stFont,0,sizeof(LOGFONT));
	stFont.lfHeight=MulDiv(13,-pDC->GetDeviceCaps(LOGPIXELSY),72);
	stFont.lfWeight=FW_NORMAL;
	stFont.lfClipPrecision=CLIP_LH_ANGLES;
	strcpy(stFont.lfFaceName,"Arial");
	for(int n=0;n<3600;n+=300)//每隔300输出字符串
	{
		stFont.lfEscapement=n;
		font.CreateFontIndirect(&stFont);
		CFont*pOldFont=pDC->SelectObject(&font);
		pDC->TextOut(rect.left+rect.Width()/2,
			rect.top+rect.Height()/2,str);//输出字体
		pDC->SelectObject(pOldFont);//恢复原来字体
		font.DeleteObject();
	}
	
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CCQingxieTextView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CCQingxieTextView diagnostics

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

void CCQingxieTextView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CCQingxieTextView message handlers

⌨️ 快捷键说明

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