📄 welcomeview.cpp
字号:
// WelcomeView.cpp : implementation of the CWelcomeView class
//
#include "stdafx.h"
#include "Welcome.h"
#include "WelcomeDoc.h"
#include "WelcomeView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWelcomeView
IMPLEMENT_DYNCREATE(CWelcomeView, CView)
BEGIN_MESSAGE_MAP(CWelcomeView, CView)
//{{AFX_MSG_MAP(CWelcomeView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CWelcomeView construction/destruction
CWelcomeView::CWelcomeView()
{
// TODO: add construction code here
}
CWelcomeView::~CWelcomeView()
{
}
BOOL CWelcomeView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CWelcomeView drawing
void CWelcomeView::OnDraw(CDC* pDC)
{
CWelcomeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
//创建矩形对象
CRect m_rect;
//获取窗口大小
GetClientRect(&m_rect);
//设置文字显示的起始位置
int x=m_rect.right/2,y=m_rect.bottom/2;
//设置文字显示的相对位置
pDC->SetTextAlign(TA_CENTER|TA_BASELINE);
//显示文字
pDC->TextOut(x,y,"你好!欢迎进入Visual C++ 6.0的世界! ");
}
/////////////////////////////////////////////////////////////////////////////
// CWelcomeView printing
BOOL CWelcomeView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CWelcomeView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CWelcomeView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CWelcomeView diagnostics
#ifdef _DEBUG
void CWelcomeView::AssertValid() const
{
CView::AssertValid();
}
void CWelcomeView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CWelcomeDoc* CWelcomeView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWelcomeDoc)));
return (CWelcomeDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWelcomeView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -