?? ex3_4view.cpp
字號(hào):
// Ex3_4View.cpp : implementation of the CEx3_4View class
//
#include "stdafx.h"
#include "Ex3_4.h"
#include "Ex3_4Doc.h"
#include "Ex3_4View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx3_4View
IMPLEMENT_DYNCREATE(CEx3_4View, CScrollView)
BEGIN_MESSAGE_MAP(CEx3_4View, CScrollView)
//{{AFX_MSG_MAP(CEx3_4View)
// 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, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEx3_4View construction/destruction
CEx3_4View::CEx3_4View()
{
// TODO: add construction code here
}
CEx3_4View::~CEx3_4View()
{
}
BOOL CEx3_4View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx3_4View drawing
void CEx3_4View::OnDraw(CDC* pDC)
{
CEx3_4Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
TEXTMETRIC tm;
int x,y, cy, i;
char sz[20];
pDC->GetTextMetrics(&tm);
cy = tm.tmHeight;
pDC->SetTextColor(RGB(0, 0, 255)); // red text
for (x=5,y=5,i=0; i<DATANUM; i++,y+=cy)
{
wsprintf (sz, "%d", pDoc->arr[i]);
pDC->TextOut (x,y, sz, lstrlen(sz));
}
}
void CEx3_4View::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CEx3_4View printing
BOOL CEx3_4View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx3_4View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx3_4View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx3_4View diagnostics
#ifdef _DEBUG
void CEx3_4View::AssertValid() const
{
CScrollView::AssertValid();
}
void CEx3_4View::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CEx3_4Doc* CEx3_4View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx3_4Doc)));
return (CEx3_4Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx3_4View message handlers
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -