📄 chapter05view.cpp
字号:
// Chapter05View.cpp : implementation of the CChapter05View class
//
#include "stdafx.h"
#include "Chapter05.h"
#include "Chapter05Doc.h"
#include "Chapter05View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChapter05View
IMPLEMENT_DYNCREATE(CChapter05View, CView)
BEGIN_MESSAGE_MAP(CChapter05View, CView)
//{{AFX_MSG_MAP(CChapter05View)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChapter05View construction/destruction
CChapter05View::CChapter05View()
{
// TODO: add construction code here
}
CChapter05View::~CChapter05View()
{
}
BOOL CChapter05View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CChapter05View drawing
void CChapter05View::OnDraw(CDC* pDC)
{
CChapter05Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CChapter05View diagnostics
#ifdef _DEBUG
void CChapter05View::AssertValid() const
{
CView::AssertValid();
}
void CChapter05View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CChapter05Doc* CChapter05View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CChapter05Doc)));
return (CChapter05Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChapter05View message handlers
void CChapter05View::IdleCounter(long lCount)
{
//定义字符串对象
CString strCount,strTem;
strTem="OnIdle已经被调用的次数为:";
//获取设备上下文,以便在上面写文字
pDc=GetWindowDC();
//格式化字符串
strCount.Format("%s%d",strTem,lCount);
//输出文本
pDc->TextOut(100,100,strCount);
//刷新视图的客户区
Invalidate();
//设防资源
ReleaseDC(pDc);
//延迟,以便能看清显示的文字(毫秒单位)
Sleep(100);
}
void CChapter05View::OnInitialUpdate()
{
CView::OnInitialUpdate();hjjkjk
// TODO: Add your specialized code here and/or call the base class
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -