fillpat.cpp
来自「一个复杂的画图系统」· C++ 代码 · 共 58 行
CPP
58 行
// FillPat.cpp: implementation of the FillPat class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "geditor.h"
#include "FillPat.h"
#include "geditorView.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
FillPat::FillPat()
{
}
FillPat::FillPat(CPoint &pt,unsigned int color)
{
fillpt=pt;
m_color=color;
}
FillPat::~FillPat()
{
}
void FillPat::Draw(CDC *pDC)
{
int oldROP2 = pDC->SetROP2(R2_COPYPEN);
CBrush brush(m_color);
CBrush* oldBrush = pDC->SelectObject(&brush);
pDC->ExtFloodFill(fillpt.x, fillpt.y,pDC->GetPixel(fillpt),
FLOODFILLSURFACE);
pDC->SelectObject(oldBrush);
pDC->SetROP2(oldROP2);
}
void FillPat::Serialize(CArchive &ar)
{
CObject::Serialize(ar);
if(ar.IsStoring())
{
ar<<m_color<<fillpt;
}
else
{
ar>>m_color>>fillpt;
};
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?