📄 dsotestview.cpp
字号:
// DSOTESTView.cpp : implementation of the CDSOTESTView class
//
#include "stdafx.h"
#include "DSOTEST.h"
#include "DSOTESTDoc.h"
#include "DSOTESTView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDSOTESTView
IMPLEMENT_DYNCREATE(CDSOTESTView, CView)
BEGIN_MESSAGE_MAP(CDSOTESTView, CView)
//{{AFX_MSG_MAP(CDSOTESTView)
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()
/////////////////////////////////////////////////////////////////////////////
// CDSOTESTView construction/destruction
CDSOTESTView::CDSOTESTView()
{
// TODO: add construction code here
m_bmpSplash.LoadBitmap(IDB_BITMAP_DSO);
}
CDSOTESTView::~CDSOTESTView()
{
}
BOOL CDSOTESTView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CDSOTESTView drawing
void CDSOTESTView::OnDraw(CDC* pDC)
{
CDSOTESTDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CDSOTESTView printing
BOOL CDSOTESTView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CDSOTESTView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CDSOTESTView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CDSOTESTView diagnostics
#ifdef _DEBUG
void CDSOTESTView::AssertValid() const
{
CView::AssertValid();
}
void CDSOTESTView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CDSOTESTDoc* CDSOTESTView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDSOTESTDoc)));
return (CDSOTESTDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDSOTESTView message handlers
BOOL CDSOTESTView::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect (&rect);
HBRUSH key = ::CreateSolidBrush( RGB(205,220,225) );
BITMAP bm;
RECT rc;
m_bmpSplash.GetBitmap( &bm );
// calc top side of splash bitmap to paint
rc.left = 0;
rc.top = 0;
rc.right = rect.Width();
rc.bottom = (rect.Height() - bm.bmHeight) / 2;
FillRect(pDC->GetSafeHdc(), &rc, key);
// calc left side of splash bitmap to paint
rc.left = 0;
rc.top = (rect.Height() - bm.bmHeight) / 2;
rc.right = (rect.Width() - bm.bmWidth) / 2;
rc.bottom = (rect.Height() - bm.bmHeight) / 2 + bm.bmHeight;
::FillRect(pDC->GetSafeHdc(), &rc, key);
// calc right side of splash bitmap to paint
rc.left = (rect.Width() - bm.bmWidth) / 2 + bm.bmWidth;
rc.top = (rect.Height() - bm.bmHeight) / 2;
rc.right = rect.Width();
rc.bottom = (rect.Height() - bm.bmHeight) / 2 + bm.bmHeight;
::FillRect(pDC->GetSafeHdc(), &rc, key);
// calc bottom side of splash bitmap to paint
rc.left = 0;
rc.top = (rect.Height() - bm.bmHeight) / 2 + bm.bmHeight;
rc.right = rect.Width();
rc.bottom = rect.Height();
::FillRect(pDC->GetSafeHdc(), &rc, key);
::DeleteObject(key);
if ( m_bmpSplash.GetSafeHandle() )
{
pDC->SetStretchBltMode( COLORONCOLOR );
DrawSplashBmp( pDC );
}
return TRUE;
return CView::OnEraseBkgnd(pDC);
}
void CDSOTESTView::DrawSplashBmp(CDC *pDC)
{BITMAP bm;
m_bmpSplash.GetBitmap (&bm);
CDC memDC;
memDC.CreateCompatibleDC (pDC);
HGDIOBJ hBmpOld = memDC.SelectObject (m_bmpSplash);
CRect rc;
GetClientRect (rc);
pDC->BitBlt ((rc.Width () - bm.bmWidth) / 2, (rc.Height () - bm.bmHeight) / 2, bm.bmWidth, bm.bmHeight, &memDC, 0, 0, SRCCOPY);
memDC.SelectObject (hBmpOld);
memDC.DeleteDC ();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -