⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 box.cpp

📁 Julia集的分形算法
💻 CPP
字号:
#include "StdAfx.h"
#include "Box.h"

CBox::~CBox()
{
	if(hPen)
	{
		DeleteObject(hPen);
	}
}
CBox::CBox(COLORREF color)
{
	bHasBox = FALSE;
	m_Color = color;
	last_Rect.left = last_Rect.right = last_Rect.bottom = last_Rect.top = 0;
	hPen = CreatePen(PS_SOLID,2,color);
}
void CBox::Draw(HDC hDC,RECT Rect)
{
	SelectObject(hDC,hPen);
	SetROP2(hDC,R2_XORPEN);
	if(bHasBox) OverPreDraw(hDC);
	MyRectangle(hDC,Rect.left,Rect.top,Rect.right,Rect.bottom);
	bHasBox = TRUE;
	last_Rect = Rect;
}

void CBox::MKPoint(POINT& pt,int x,int y)
{
	pt.x = x;
	pt.y = y;
}

void CBox::MyRectangle(HDC hdc,int left,int top,int right,int bottom)
{
	POINT pt[5] = {0};
	MKPoint(pt[0],left,top);
	MKPoint(pt[1],right,top);
	MKPoint(pt[2],right,bottom);
	MKPoint(pt[3],left,bottom);
	MKPoint(pt[4],left,top);
	Polyline(hdc,pt,5);
}
void CBox::OverPreDraw(HDC hDC)
{
	if(bHasBox)
	{
		MyRectangle(hDC,last_Rect.left,last_Rect.top,last_Rect.right,last_Rect.bottom);
		bHasBox = FALSE;
	}
}

void CBox::Reset()
{
	bHasBox = FALSE;
}

void CBox::SetColor(COLORREF color)
{
	m_Color = color;
	if(hPen)
	{
		DeleteObject(hPen);
		hPen = CreatePen(PS_SOLID,2,color);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -