📄 vc09view.cpp
字号:
// vc09View.cpp : implementation of the CVc09View class
//
#include "stdafx.h"
#include "vc09.h"
#include "vc09Doc.h"
#include "vc09View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVc09View
IMPLEMENT_DYNCREATE(CVc09View, CView)
BEGIN_MESSAGE_MAP(CVc09View, CView)
//{{AFX_MSG_MAP(CVc09View)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CVc09View construction/destruction
CVc09View::CVc09View()
{
// TODO: add construction code here
}
CVc09View::~CVc09View()
{
}
BOOL CVc09View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CVc09View drawing
void CVc09View::OnDraw(CDC* pDC)
{
CVc09Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->SetBkColor(RGB(240,240,250));
pDC->SetTextColor(RGB(255,0,0));
int ny = -5;
int ndl = 0;
for (int i = 24; i >= 12; i -= 4) {
FontOut(pDC, ny, i, ndl);
ndl += 300;
}
}
/////////////////////////////////////////////////////////////////////////////
// CVc09View printing
BOOL CVc09View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CVc09View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CVc09View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CVc09View::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
CRect cr;
GetClientRect(cr);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(100, 180);
pDC->SetViewportExt(cr.right,-cr.bottom);
}
void CVc09View::FontOut(CDC* pDC, int& nHeight, int nPoints,int dline)
{
TEXTMETRIC textM;
CFont font;
CString str;
font.CreateFont(-nPoints, 0, dline, 0, 400, FALSE, FALSE, 0,
ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS, "宋体");
CFont* poldfont = (CFont*) pDC->SelectObject(&font);
pDC->GetTextMetrics(&textM);
str.Format("这是%d点阵宋体字", nPoints);
pDC->TextOut(10, nHeight, str);
nHeight -= textM.tmHeight + textM.tmExternalLeading;
pDC->SelectObject(poldfont);
}
/////////////////////////////////////////////////////////////////////////////
// CVc09View diagnostics
#ifdef _DEBUG
void CVc09View::AssertValid() const
{
CView::AssertValid();
}
void CVc09View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CVc09Doc* CVc09View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVc09Doc)));
return (CVc09Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CVc09View message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -