• 大小: 5.04MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-17
  • 语言: C/C++
  • 标签: MFC  CAD  

资源简介

该文件是一个基于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个文件信息

评论

共有 条评论