📄 gjtview.cpp
字号:
// GJTView.cpp : implementation of the CGJTView class
//
#include "stdafx.h"
#include "GJT.h"
#include "GJTDoc.h"
#include "GJTView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGJTView
IMPLEMENT_DYNCREATE(CGJTView, CView)
BEGIN_MESSAGE_MAP(CGJTView, CView)
//{{AFX_MSG_MAP(CGJTView)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGJTView construction/destruction
CGJTView::CGJTView()
{
// TODO: add construction code here
VERIFY(m_bmp.LoadBitmap(IDB_BITMAP5));
}
CGJTView::~CGJTView()
{
}
BOOL CGJTView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CGJTView drawing
void CGJTView::OnDraw(CDC* pDC)
{
CGJTDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CGJTView printing
BOOL CGJTView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CGJTView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CGJTView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CGJTView diagnostics
#ifdef _DEBUG
void CGJTView::AssertValid() const
{
CView::AssertValid();
}
void CGJTView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CGJTDoc* CGJTView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGJTDoc)));
return (CGJTDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CGJTView message handlers
BOOL CGJTView::OnEraseBkgnd(CDC* pDC)
{
int nWidth;
int nHeight;
//CView::OnEraseBkgnd(pDC);
CGJTDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rect;
GetWindowRect(&rect);
nWidth = rect.Width();
nHeight= rect.Height();
CDC MemDC;
CBitmap MemBitmap;
MemDC.CreateCompatibleDC (NULL);
MemBitmap.CreateCompatibleBitmap(pDC,nWidth,nHeight);
CBitmap *pOldBit=MemDC.SelectObject(&MemBitmap);
MemDC.FillSolidRect(0,0,nWidth,nHeight,RGB(255,255,255));
GetClientRect(rect);
BITMAP bm;
CDC dcMem;
VERIFY(m_bmp.GetObject(sizeof(bm),(LPVOID)&bm));
dcMem.CreateCompatibleDC(pDC);
CBitmap *pOldBMP =( CBitmap *)dcMem.SelectObject(&m_bmp);
MemDC.BitBlt( (rect.right - bm.bmWidth)/2,
(rect.bottom - bm.bmHeight)/2,
bm.bmWidth,bm.bmHeight,&dcMem,0,0,SRCCOPY);
dcMem.SelectObject(pOldBMP);
pDC->BitBlt(0,0,nWidth,nHeight,&MemDC,0,0,SRCCOPY);
MemBitmap.DeleteObject();
MemDC.DeleteDC();
return TRUE;
// return CView::OnEraseBkgnd(pDC);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -