📄 brushview.cpp
字号:
// BrushView.cpp : implementation of the CBrushView class
//
#include "stdafx.h"
#include "Brush.h"
#include "BrushDoc.h"
#include "BrushView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBrushView
IMPLEMENT_DYNCREATE(CBrushView, CView)
BEGIN_MESSAGE_MAP(CBrushView, CView)
//{{AFX_MSG_MAP(CBrushView)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CBrushView construction/destruction
CBrushView::CBrushView()
{
// TODO: add construction code here
}
CBrushView::~CBrushView()
{
}
BOOL CBrushView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CBrushView drawing
void CBrushView::OnDraw(CDC* pDC)
{
CBrushDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
ShowBrush(pDC);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CBrushView printing
BOOL CBrushView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
/////////////////////////////////////////////////////////////////////////////
// CBrushView diagnostics
#ifdef _DEBUG
void CBrushView::AssertValid() const
{
CView::AssertValid();
}
void CBrushView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CBrushDoc* CBrushView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBrushDoc)));
return (CBrushDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBrushView message handlers
void CBrushView::ShowBrush(CDC *pDC)
{
UINT position=0;
int m=100;
for(int x=0; x<7 ;x++)
{
CBrush* brush;
if(x==6)
brush=new CBrush(RGB(0,100,255));
else
brush=new CBrush(x,RGB(m,155,220));
m=m+30;
CBrush* oldBrush=pDC->SelectObject (brush);
position+=50;
pDC->Rectangle (60,position,650,position+30);
pDC->SelectObject (oldBrush);
delete brush;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -