📄 cdellipse.cpp
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -