资源简介
该文件是一个基于MFC的小型CAD系统,系统实现了直线、圆、矩形、正方形、多边形等多个图形的绘制,以及颜色设置等等功能,值得向初学VC++者推荐……

代码片段和文件信息
#include “stdafx.h“
#include “CCurve.h“
#include“EastDrawView.h“
IMPLEMENT_SERIAL(CCurveCobject1)
void CCurve::DrawStatic(CDC*pDC)
{
CPen m_pen;
m_pen.CreatePen(m_Penstylem_PenWidthm_PenColor);
CPen* pen=(CPen*)pDC->Selectobject(&m_pen);
int oldDrawingMode=pDC->SetROP2(m_DrawingMode);
m_FirstPoint=m_PointList->GetAt(0);
pDC->MoveTo(m_FirstPoint);
for(int i=0;iGetSize();i++)
{
pDC->LineTo(m_PointList->GetAt(i));
pDC->LineTo(m_PointList->GetAt(i));
}
pDC->LineTo(m_PointList->GetAt(i-1));
pDC->Selectobject(pen);
pDC->SetROP2(oldDrawingMode);
}
int CCurve::IsOnMarginPoint(CPoint point)
{
CRect rect;
for(int i=0;iGetSize();i=i+10)
{
rect=CRect(m_PointList->GetAt(i)m_PointList->GetAt(i));
rect.InflateRect(44);
if(rect.PtInRect(point))
{
m_FoundPoint=m_PointList->GetAt(i);
return i+i;
}
}
return -1;
}
void CCurve::Initial()
{
CUnit::Initial();
m_PointList=new CArray;
}
void CCurve::Serialize(CArchive &ar)
{
if(ar.IsStoring())
{
ar<yle< }
else
{
ar>>m_PenColor>>m_Penstyle>>m_PenWidth;
}
m_PointList->Serialize(ar);
}
CCurve::CCurve()
{
Initial();
}
void CCurve::DrawMask(CDC*pDCCPoint firstCPoint second)
{
CPen m_pen;
m_pen.CreatePen(m_Penstylem_PenWidthm_PenColor);
CPen* pen=(CPen*)pDC->Selectobject(&m_pen);
pDC->MoveTo(first);
pDC->LineTo(second);
pDC->Selectobject(pen);
}
BOOL CCurve::IsInRgn(CPoint point)
{
CRect rect;
for(int i=0;iGetSize();i++)
{
rect=CRect(m_PointList->GetAt(i)m_PointList->GetAt(i));
rect.InflateRect(99);
if(rect.PtInRect(point))
return i;
}
return -1;
}
void CCurve::ShowSelectPoint(CDC *pDC)
{
CRect rect;
CBrush brush;
brush.CreateSolidBrush(RGB(25500));
CPen m_pen;
m_pen.CreatePen(PS_SOLID1RGB(00255));
CPen *OldPen=pDC->Selectobject(&m_pen);
int oldBkMode=pDC->SetBkMode(OPAQUE);
CBrush *OldBrush=pDC->Selectobject(&brush);
int oldDrawingMode=pDC->SetROP2(R2_NOTXORPEN);
for(int i=0;iGetSize();i=i+10)
{
rect=CRect(m_PointList->GetAt(i)m_PointList->GetAt(i));
rect.InflateRect(33);
pDC->Rectangle(rect);
}
pDC->Selectobject(OldPen);
pDC->SetBkMode(oldBkMode);
pDC->Selectobject(OldBrush);
pDC->SetROP2(oldDrawingMode);
}
CRect CCurve::GetBoundingRect()
{
m_MinPoint=m_MaxPoint=m_PointList->GetAt(0);
for(int i=0;iGetSize();i++)
{
m_MinPoint.x=min(m_MinPoint.xm_PointList->GetAt(i).x);
m_MinPoint.y=min(m_MinPoint.ym_PointList->GetAt(i).y);
m_MaxPoint.x=max(m_MaxPoint.xm_PointList->GetAt(i).x);
m_MaxPoint.y=max(m_MaxPoint.ym_PointList->GetAt(i).y);
}
this->m_BoundingRect.SetRect(this->m_MinPointthis->m_MaxPoint);
return this->m_BoundingRect;
}
void CCurve::DrawActive(CDC *pDCCPoint point)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4484 2002-06-09 01:14 基于MFC的CAD基本图形绘制系统\EastDraw\CCurve.cpp
文件 657 2002-05-28 09:57 基于MFC的CAD基本图形绘制系统\EastDraw\CCurve.h
文件 8526 2002-06-15 16:46 基于MFC的CAD基本图形绘制系统\EastDraw\CDLine.cpp
文件 603 2002-05-28 14:52 基于MFC的CAD基本图形绘制系统\EastDraw\CDLine.h
文件 15702 2002-09-01 12:05 基于MFC的CAD基本图形绘制系统\EastDraw\CEllipse.cpp
文件 1365 2002-05-31 10:49 基于MFC的CAD基本图形绘制系统\EastDraw\CEllipse.h
文件 14047 2002-06-09 20:08 基于MFC的CAD基本图形绘制系统\EastDraw\CEllipseArc.cpp
文件 1490 2002-06-09 00:42 基于MFC的CAD基本图形绘制系统\EastDraw\CEllipseArc.h
文件 1535 2002-09-03 09:53 基于MFC的CAD基本图形绘制系统\EastDraw\ChildFrm.cpp
文件 1397 2002-09-03 09:53 基于MFC的CAD基本图形绘制系统\EastDraw\ChildFrm.h
文件 7803 2002-06-09 12:24 基于MFC的CAD基本图形绘制系统\EastDraw\CLiEllipse.cpp
文件 566 2002-05-28 10:04 基于MFC的CAD基本图形绘制系统\EastDraw\CLiEllipse.h
文件 7867 2002-06-21 17:18 基于MFC的CAD基本图形绘制系统\EastDraw\CPolyBezier.cpp
文件 753 2002-05-31 10:51 基于MFC的CAD基本图形绘制系统\EastDraw\CPolyBezier.h
文件 12075 2011-06-25 23:35 基于MFC的CAD基本图形绘制系统\EastDraw\CPolygon.cpp
文件 731 2002-05-28 10:03 基于MFC的CAD基本图形绘制系统\EastDraw\CPolygon.h
文件 7452 2002-06-23 21:40 基于MFC的CAD基本图形绘制系统\EastDraw\CRectangle.cpp
文件 559 2002-05-28 10:03 基于MFC的CAD基本图形绘制系统\EastDraw\CRectangle.h
文件 8889 2002-06-23 21:35 基于MFC的CAD基本图形绘制系统\EastDraw\CRound.cpp
文件 605 2002-05-28 10:03 基于MFC的CAD基本图形绘制系统\EastDraw\CRound.h
文件 8343 2002-06-24 11:30 基于MFC的CAD基本图形绘制系统\EastDraw\CRoundArc.cpp
文件 690 2002-05-28 10:03 基于MFC的CAD基本图形绘制系统\EastDraw\CRoundArc.h
文件 8290 2002-06-23 23:06 基于MFC的CAD基本图形绘制系统\EastDraw\CRoundRectangle.cpp
文件 587 2002-05-28 10:03 基于MFC的CAD基本图形绘制系统\EastDraw\CRoundRectangle.h
文件 11102 2011-06-24 20:45 基于MFC的CAD基本图形绘制系统\EastDraw\CText.cpp
文件 899 2002-05-30 15:01 基于MFC的CAD基本图形绘制系统\EastDraw\CText.h
文件 4944 2011-06-25 23:02 基于MFC的CAD基本图形绘制系统\EastDraw\CUnit.cpp
文件 3883 2002-06-09 12:21 基于MFC的CAD基本图形绘制系统\EastDraw\CUnit.h
文件 48057 2011-06-24 21:02 基于MFC的CAD基本图形绘制系统\EastDraw\Debug\CCurve.obj
文件 0 2011-06-24 21:02 基于MFC的CAD基本图形绘制系统\EastDraw\Debug\CCurve.sbr
............此处省略136个文件信息
- 上一篇:C++编定的LR0分析表
- 下一篇:C语言程序设计 中文第二版教材+习题答案
相关资源
- 基于mfc的多线程文件传输
- MFC数字钟(基于VC6.0)
- VC++MFC小游戏实例教程(实例)+MFC类库
- ChartCtrl控件库(可在VS2019中使用)
- 商品库存管理系统 C++ MFC
- mfc 调用redis
- MFC视频播放器源码(支持avi/wma/mp3等格
- mfc绘图大全(画直线、矩形、椭圆)
- MFC控件重绘
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- MFC文档_视图_框架_模板结构体系深入
- 简单员工管理系统(适合初学MFC)
- MFC五子棋游戏
- MFC UDP编程
- MFC的异步网络通讯应用程序
- C++MFC模块讲解,黑发程序员课程整理
- 一个简单而强大的基于MFC的web server源
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- MFCaccess.rar
- VC++MFC课程设计的学生成绩管理系统
- MFC 日历控件 万年历 Calendar自绘
- CrystalDiskInfo-HDD/SSD硬盘信息,SMART信息
- MFC自定义界面HUI,高效简单,含详细
- 仿射密码-Affine cipher
- c++MFC车牌自动识别定位,只能定位和
- mfc+sql 酒店客房管理系统
- 基于图割的图像分割OpenCV+MFC实现
- MFC绘制Bezier曲线B样条曲线曲线拟合
- MFC坦克大战
评论
共有 条评论