📄 exampleview.cpp
字号:
// ExampleView.cpp : implementation of the CExampleView class
//
#include "stdafx.h"
#include "Example.h"
#include "ExampleDoc.h"
#include "ExampleView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExampleView
IMPLEMENT_DYNCREATE(CExampleView, CView)
BEGIN_MESSAGE_MAP(CExampleView, CView)
//{{AFX_MSG_MAP(CExampleView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CExampleView construction/destruction
CExampleView::CExampleView()
{
// TODO: add construction code here
}
CExampleView::~CExampleView()
{
}
BOOL CExampleView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CExampleView drawing
void CExampleView::OnDraw(CDC* pDC)
{
CExampleDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
if (GetDocument()->GetPathName()!="" )
{
HBITMAP bitmap;
bitmap=(HBITMAP)LoadImage(AfxGetInstanceHandle(),
GetDocument()->GetPathName(),IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
HBITMAP OldBitmap;
CDC MemDC;
MemDC.CreateCompatibleDC(pDC);
CRect rect;
GetClientRect(rect);
OldBitmap=(HBITMAP)MemDC.SelectObject(bitmap);
pDC->BitBlt(0,0,rect.Width(),rect.Height(),&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(OldBitmap);
}
}
/////////////////////////////////////////////////////////////////////////////
// CExampleView diagnostics
#ifdef _DEBUG
void CExampleView::AssertValid() const
{
CView::AssertValid();
}
void CExampleView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CExampleDoc* CExampleView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExampleDoc)));
return (CExampleDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CExampleView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -