📄 tabview2.cpp
字号:
// viewTwo.cpp : implementation file
//
#include "stdafx.h"
#include "tab.h"
#include "TabDoc.h"
#include "TabView2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTabView2
IMPLEMENT_DYNCREATE(CTabView2, CView)
CTabView2::CTabView2()
{
}
CTabView2::~CTabView2()
{
}
BEGIN_MESSAGE_MAP(CTabView2, CView)
//{{AFX_MSG_MAP(CTabView2)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CTabView2::OnDraw(CDC* pDC)
{
//设置字体
CFont fnt;
LOGFONT fl;
memset(&fl , 0 ,sizeof(LOGFONT));
fl.lfHeight = 30;
fl.lfWidth = 15;
fl.lfWeight =500;
fnt.CreateFontIndirect(&fl);
CFont *pOldFont = pDC->SelectObject( &fnt );
pDC->TextOut(30,40,"This is CView2 derived from CView");
pDC->SelectObject( pOldFont );
}
/////////////////////////////////////////////////////////////////////////////
// CTabView2 diagnostics
#ifdef _DEBUG
void CTabView2::AssertValid() const
{
CView::AssertValid();
}
void CTabView2::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTabView2 message handlers
void CTabView2::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
SetTimer(2,500,NULL);
}
void CTabView2::OnTimer(UINT nIDEvent)
{
if(nIDEvent==2)
{
m_Increase=((CTabDoc*)GetDocument())->m_Accumulater++;
CString str;
str.Format("Counter : %d",m_Increase);
CDC *pDC=GetDC();
pDC->TextOut(200,100,str,str.GetLength());
}
CView::OnTimer(nIDEvent);
}
BOOL CTabView2::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
KillTimer(2);
return CView::DestroyWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -