📄 dialogview.cpp
字号:
// DialogView.cpp : implementation of the CDialogView class
//
#include "stdafx.h"
#include "Dialog.h"
#include "DialogDoc.h"
#include "DialogView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogView
IMPLEMENT_DYNCREATE(CDialogView, CView)
BEGIN_MESSAGE_MAP(CDialogView, CView)
//{{AFX_MSG_MAP(CDialogView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CDialogView construction/destruction
CDialogView::CDialogView()
{
// TODO: add construction code here
}
CDialogView::~CDialogView()
{
}
BOOL CDialogView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CDialogView drawing
void CDialogView::OnDraw(CDC* pDC)
{
CDialogDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CFont font,tempfont;
LOGFONT lf;
tempfont.CreateStockObject(SYSTEM_FIXED_FONT);
tempfont.GetObject(sizeof(LOGFONT),&lf);
if(pDoc->m_italic)
lf.lfItalic=1;
if(pDoc->m_bold)
lf.lfWeight=FW_BOLD;
if(pDoc->m_underline)
lf.lfUnderline=1;
font.CreateFontIndirect(&lf);
switch(pDoc->m_color)
{
case 0:
pDC->SetTextColor(RGB(255,0,0));
break;
case 1:
pDC->SetTextColor(RGB(0,0,255));
break;
case 2:
pDC->SetTextColor(RGB(0,255,0));
}
pDC->SelectObject(&font);
pDC->TextOut(10,10,"Hello World");
}
/////////////////////////////////////////////////////////////////////////////
// CDialogView printing
BOOL CDialogView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CDialogView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CDialogView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CDialogView diagnostics
#ifdef _DEBUG
void CDialogView::AssertValid() const
{
CView::AssertValid();
}
void CDialogView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CDialogDoc* CDialogView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDialogDoc)));
return (CDialogDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDialogView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -