📄 sdi_bmpbkgview.cpp
字号:
// SDI_BMPBKGView.cpp : implementation of the CSDI_BMPBKGView class
//
#include "stdafx.h"
#include "SDI_BMPBKG.h"
#include "SDI_BMPBKGDoc.h"
#include "SDI_BMPBKGView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSDI_BMPBKGView
IMPLEMENT_DYNCREATE(CSDI_BMPBKGView, CView)
BEGIN_MESSAGE_MAP(CSDI_BMPBKGView, CView)
//{{AFX_MSG_MAP(CSDI_BMPBKGView)
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()
/////////////////////////////////////////////////////////////////////////////
// CSDI_BMPBKGView construction/destruction
CSDI_BMPBKGView::CSDI_BMPBKGView()
{
m_bmpBackground.LoadResource(IDB_BKGBMP);
}
CSDI_BMPBKGView::~CSDI_BMPBKGView()
{
}
BOOL CSDI_BMPBKGView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CSDI_BMPBKGView drawing
void CSDI_BMPBKGView::OnDraw(CDC* pDC)
{
CSDI_BMPBKGDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CSDI_BMPBKGView printing
BOOL CSDI_BMPBKGView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSDI_BMPBKGView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSDI_BMPBKGView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CSDI_BMPBKGView diagnostics
#ifdef _DEBUG
void CSDI_BMPBKGView::AssertValid() const
{
CView::AssertValid();
}
void CSDI_BMPBKGView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CSDI_BMPBKGDoc* CSDI_BMPBKGView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSDI_BMPBKGDoc)));
return (CSDI_BMPBKGDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSDI_BMPBKGView message handlers
BOOL CSDI_BMPBKGView::OnEraseBkgnd(CDC* pDC)
{
int x,y;
CRect rc;
GetClientRect(&rc);
x=0;y=0;
while(y < rc.Height())
{ //rc表示对话框的大小尺寸
while(x < rc.Width())
{
m_bmpBackground.DrawBMP(pDC, x, y);
x += m_bmpBackground.GetWidth(); //得到位图的宽度
}
x = 0;
y += m_bmpBackground.GetHeight(); //得到位图的高度
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -