📄 testmenuview.cpp
字号:
// testmenuView.cpp : implementation of the CTestmenuView class
//
#include "stdafx.h"
#include "testmenu.h"
#include "maskedBitmap.h"
#include "testmenuDoc.h"
#include "testmenuView.h"
// #include "mainfrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestmenuView
IMPLEMENT_DYNCREATE(CTestmenuView, CView)
BEGIN_MESSAGE_MAP(CTestmenuView, CView)
//{{AFX_MSG_MAP(CTestmenuView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CTestmenuView construction/destruction
CTestmenuView::CTestmenuView()
{
// TODO: add construction code here
m_bitmap.LoadBitmap (IDB_BITMAP2);
}
CTestmenuView::~CTestmenuView()
{
}
BOOL CTestmenuView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CTestmenuView drawing
void CTestmenuView::OnDraw(CDC* pDC)
{
CTestmenuDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
#define BMoffsetX 6
#define BMoffsetY 6
CRect rect;
GetClientRect (&rect);
DoGradientFill (pDC, &rect); // Draw an attractive gradient behind the bitmap.
m_bitmap.Draw (pDC, BMoffsetX, BMoffsetY); // Draw the bitmap (a painting of the CO-MEMs in the system).
}
/////////////////////////////////////////////////////////////////////////////
// CTestmenuView diagnostics
#ifdef _DEBUG
void CTestmenuView::AssertValid() const
{
CView::AssertValid();
}
void CTestmenuView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CTestmenuDoc* CTestmenuView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestmenuDoc)));
return (CTestmenuDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestmenuView message handlers
// NULL for now
/////////////////////////////////////////////////////////////////////////////
// CTestmenuView helper funtions
COLORREF CTestmenuView::get_bitmapBackColor (void)
{
return m_bitmap.m_bitmapBackColor;
}
void CTestmenuView::DoGradientFill (CDC* pDC, CRect* pRect)
{
CBrush* pBrush[64];
for (int i=0; i<64; i++)
pBrush[i] = new CBrush (PALETTERGB (0, 0, 255 - (i * 4)));
int nWidth = pRect->Width ();
int nHeight = pRect->Height ();
CRect rect;
for (i=0; i<nHeight; i++) {
rect.SetRect (0, i, nWidth, i + 1);
pDC->FillRect (&rect, pBrush[(i * 63) / nHeight]);
}
for (i=0; i<64; i++)
delete pBrush[i];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -