chapter5_3_2view.cpp
来自「windows ce开发技巧与实例光盘代码」· C++ 代码 · 共 101 行
CPP
101 行
// Chapter5_3_2View.cpp : implementation of the CChapter5_3_2View class
//
#include "stdafx.h"
#include "Chapter5_3_2.h"
#include "Chapter5_3_2Doc.h"
#include "Chapter5_3_2View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChapter5_3_2View
IMPLEMENT_DYNCREATE(CChapter5_3_2View, CView)
BEGIN_MESSAGE_MAP(CChapter5_3_2View, CView)
//{{AFX_MSG_MAP(CChapter5_3_2View)
// 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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChapter5_3_2View construction/destruction
CChapter5_3_2View::CChapter5_3_2View()
{
// TODO: add construction code here
}
CChapter5_3_2View::~CChapter5_3_2View()
{
}
BOOL CChapter5_3_2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CChapter5_3_2View drawing
void CChapter5_3_2View::OnDraw(CDC* pDC)
{
CChapter5_3_2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// assuming code is in the OnDraw method of a view....
CBitmap bitmap;
// Attach the bitmap object to the HBITMAP returned by SHLoadImageFile
bitmap.Attach(SHLoadImageFile(_T("\\My Documents\\aaaa.gif")));
BITMAP bmpInfo;
bitmap.GetBitmap(&bmpInfo);
CDC bitmapDC;
bitmapDC.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = bitmapDC.SelectObject(&bitmap);
pDC->BitBlt(0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &bitmapDC,
0, 0, SRCCOPY);
bitmapDC.SelectObject(pOldBitmap);
bitmap.DeleteObject();
}
/////////////////////////////////////////////////////////////////////////////
// CChapter5_3_2View diagnostics
#ifdef _DEBUG
void CChapter5_3_2View::AssertValid() const
{
CView::AssertValid();
}
void CChapter5_3_2View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CChapter5_3_2Doc* CChapter5_3_2View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CChapter5_3_2Doc)));
return (CChapter5_3_2Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChapter5_3_2View message handlers
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?