cdellipse.cpp

来自「Wince 下的画图软件的源代码,是一款不错的EVC图形编辑软件,可以直接作为P」· C++ 代码 · 共 102 行

CPP
102
字号
#include "stdafx.h"
#include"CDEllipse.h"

//#include "test1View.h"

IMPLEMENT_SERIAL(CDEllipse,CUnit,1)
void CDEllipse::DrawStatic(CDC*pDC)
{
	/*

	CPen m_pen;
	m_pen.CreatePen(PS_SOLID,2,m_PenColor);
	CPen* pen=(CPen*)pDC->SelectObject(&m_pen);

	if(m_transparence)
	pDC->SelectStockObject(NULL_BRUSH);
	else
	{
	CBrush m_brush;
	m_brush.CreateSolidBrush(m_BackgroundColor);
	pDC->SelectObject(&m_brush);
	}
	pDC->Ellipse(m_FirstPoint.x,m_FirstPoint.y,m_SecondPoint.x,m_SecondPoint.y);
	*/
	HPEN m_pen,m_oldpen;
	m_pen=CreatePen(m_PenStyle,m_PenWidth,m_PenColor);
	m_oldpen=(HPEN)SelectObject(hMemDC,m_pen);
	if(m_transparence)
		SelectObject(hMemDC,GetStockObject(NULL_BRUSH));
	else
	{
		HBRUSH m_brush;
		m_brush=CreateSolidBrush(m_BackgroundColor);
		SelectObject(hMemDC,m_brush);
	}
	Ellipse(hMemDC,m_FirstPoint.x,m_FirstPoint.y,m_SecondPoint.x,m_SecondPoint.y);
	BitBlt(pDC->m_hDC, 0, 0, iScreenWidth,iScreenHeight,hMemDC,0, 0, SRCCOPY); 
	
}

CDEllipse::CDEllipse()
{ 
	CUnit::Initial();
	
	
}



void CDEllipse::Initial()
{
	m_FirstPoint=0;
	m_SecondPoint=0;
	m_PenColor=RGB(0,0,0);
	m_PenWidth=2;
	m_PenStyle=PS_SOLID;
}




void CDEllipse::DrawActive(CDC *pDC,CPoint point,char cPress)
{ 
	if(cPress==CMD_LBMOVE)
	{
		CPen m_pen;
		m_pen.CreatePen(m_PenStyle,m_PenWidth,m_PenColor);
		CPen* pen=(CPen*)pDC->SelectObject(&m_pen);
		
		BitBlt(pDC->m_hDC, 0, 0, iScreenWidth,iScreenHeight,hMemDC,0, 0	, SRCCOPY); 

		if(m_transparence)
			pDC->SelectStockObject(NULL_BRUSH);
		else
		{
			CBrush m_brush;
			m_brush.CreateSolidBrush(m_BackgroundColor);
			pDC->SelectObject(&m_brush);
		}		
		pDC->Ellipse(m_FirstPoint.x,m_FirstPoint.y,m_SecondPoint.x,m_SecondPoint.y);
	}
	else
	{
		
		HPEN m_pen,m_oldpen;
		m_pen=CreatePen(m_PenStyle,m_PenWidth,m_PenColor);
		m_oldpen=(HPEN)SelectObject(hMemDC,m_pen);
		if(m_transparence)
			SelectObject(hMemDC,GetStockObject(NULL_BRUSH));
		else
		{
			HBRUSH m_brush;
			m_brush=CreateSolidBrush(m_BackgroundColor);
			SelectObject(hMemDC,m_brush);
		}
		Ellipse(hMemDC,m_FirstPoint.x,m_FirstPoint.y,m_SecondPoint.x,m_SecondPoint.y);
		BitBlt(pDC->m_hDC, 0, 0, iScreenWidth,iScreenHeight,hMemDC,0, 0, SRCCOPY);
	}
}


⌨️ 快捷键说明

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