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

📄 amalfo~2.cpp

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

#include "stdafx.h"
#include "AmalFont.h"

#include "AmalFontDoc.h"
#include "AmalFontView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAmalFontView

IMPLEMENT_DYNCREATE(CAmalFontView, CView)

BEGIN_MESSAGE_MAP(CAmalFontView, CView)
	//{{AFX_MSG_MAP(CAmalFontView)
	ON_WM_TIMER()
	ON_COMMAND(ID_VIEW_STOP, OnViewStop)
	ON_COMMAND(ID_VIEW_START, OnViewStart)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CAmalFontView construction/destruction

CAmalFontView::CAmalFontView()
{
	m_dEscapement=0;
	m_dOrientation=0;
	// TODO: add construction code here

}

CAmalFontView::~CAmalFontView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CAmalFontView drawing

void CAmalFontView::OnDraw(CDC* pDC)
{
	CAmalFontDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	LOGFONT lf;
	CFont font;
	CFont*oldFont;
	lf.lfHeight=40;
	lf.lfWidth=0;
	lf.lfEscapement=m_dEscapement;
	lf.lfOrientation=m_dOrientation;
	lf.lfWeight=FW_NORMAL;
	lf.lfItalic=FALSE;
	lf.lfUnderline=FALSE;
	lf.lfCharSet=GB2312_CHARSET;
	lf.lfStrikeOut=FALSE;
	lf.lfOutPrecision=OUT_STROKE_PRECIS;
	lf.lfClipPrecision=CLIP_STROKE_PRECIS;
	lf.lfQuality=DRAFT_QUALITY;
	lf.lfPitchAndFamily=VARIABLE_PITCH|FF_MODERN;
	strcpy(lf.lfFaceName,"仿宋_GB2312");
	font.CreateFontIndirect(&lf);
	oldFont=pDC->SelectObject(&font);
	pDC->TextOut(100,100,"这是动画字体");
	pDC->SelectObject(oldFont);

	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CAmalFontView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CAmalFontView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CAmalFontView message handlers

void CAmalFontView::OnTimer(UINT nIDEvent) 
{
m_dEscapement=m_dEscapement+100;
m_dOrientation=m_dOrientation+100;
Invalidate();
	
	CView::OnTimer(nIDEvent);
}

void CAmalFontView::OnViewStop() 
{
	KillTimer(1);
	// TODO: Add your command handler code here
	
}

void CAmalFontView::OnViewStart() 
{
SetTimer(1,100,NULL);	
}

⌨️ 快捷键说明

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