📄 splittertestview.cpp
字号:
// SplitterTestView.cpp : implementation of the CSplitterTestView class
//
#include "stdafx.h"
#include "SplitterTest.h"
#include "SplitterTestDoc.h"
#include "SplitterTestView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSplitterTestView
IMPLEMENT_DYNCREATE(CSplitterTestView, CView)
BEGIN_MESSAGE_MAP(CSplitterTestView, CView)
//{{AFX_MSG_MAP(CSplitterTestView)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CSplitterTestView construction/destruction
CSplitterTestView::CSplitterTestView()
{
// TODO: add construction code here
flag = 0;
}
CSplitterTestView::~CSplitterTestView()
{
}
BOOL CSplitterTestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CSplitterTestView drawing
void CSplitterTestView::OnDraw(CDC* pDC)
{
CSplitterTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (flag>0)
{ //CRect rect;
//GetClientRect(&rect);
CFont font;
font.CreateFont(
96, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_HEAVY, // nWeight
FALSE, // bItalic
TRUE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"隶书");
pDC->SelectObject(&font);
pDC->SetTextColor(RGB(0,255,0));
if (flag==1)
{
pDC->TextOut(250,200,"你好");
}
else
pDC->TextOut(250,200,"再见");
}
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CSplitterTestView printing
BOOL CSplitterTestView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSplitterTestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSplitterTestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CSplitterTestView diagnostics
#ifdef _DEBUG
void CSplitterTestView::AssertValid() const
{
CView::AssertValid();
}
void CSplitterTestView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CSplitterTestDoc* CSplitterTestView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSplitterTestDoc)));
return (CSplitterTestDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSplitterTestView message handlers
//DEL BOOL CSplitterTestView::OnCommand(WPARAM wParam, LPARAM lParam)
//DEL {
//DEL // TODO: Add your specialized code here and/or call the base class
//DEL
//DEL return CView::OnCommand(wParam, lParam);
//DEL }
void CSplitterTestView::OnButton1()
{
// TODO: Add your control notification handler code here
flag = 1;
MessageBox("hello!");
Invalidate();
}
void CSplitterTestView::OnButton2()
{
// TODO: Add your control notification handler code here
flag = 2;
MessageBox("goodbye!");
Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -