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

📄 wordsetview.cpp

📁 本压缩软件为《Visual C++6.0基础教程》(黑魔方系列)一书的源代码
💻 CPP
字号:
// WordSetView.cpp : implementation of the CWordSetView class
//

#include "stdafx.h"
#include "WordSet.h"

#include "WordSetDoc.h"
#include "WordSetView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWordSetView

IMPLEMENT_DYNCREATE(CWordSetView, CView)

BEGIN_MESSAGE_MAP(CWordSetView, CView)
	//{{AFX_MSG_MAP(CWordSetView)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CWordSetView construction/destruction

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

}

CWordSetView::~CWordSetView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CWordSetView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CWordSetView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CWordSetView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CWordSetView message handlers
void CWordSetView::SetWord(CDC *pDC)
{
LOGFONT logFont;
	logFont.lfHeight=8;
	logFont.lfWidth=0;
	logFont.lfEscapement=0;
	logFont.lfOrientation=0;
	logFont.lfWeight=FW_NORMAL;
	logFont.lfItalic=0;
	logFont.lfUnderline=0;
	logFont.lfStrikeOut=0;
	logFont.lfCharSet=ANSI_CHARSET;
	logFont.lfOutPrecision=OUT_DEFAULT_PRECIS;
	logFont.lfClipPrecision=CLIP_DEFAULT_PRECIS;
	logFont.lfQuality=PROOF_QUALITY;
	logFont.lfPitchAndFamily=VARIABLE_PITCH|FF_ROMAN;
	strcpy(logFont.lfFaceName,"Times New Roman");
	UINT position=0;
	int m=300;
	for (int x=0; x <10 ;x++)
	{
		logFont.lfHeight=18+(x*10);	
		CFont font;
		font.CreateFontIndirect (&logFont);
		CFont* oldFont;
		oldFont=pDC->SelectObject(&font);
		position+=logFont.lfHeight;		
		pDC->SetTextColor(RGB(m,100,250));
		m=m-25;
		pDC->TextOut (m,position,"Show Font Word !");
		pDC->SelectObject (oldFont);
	}
}

⌨️ 快捷键说明

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