• 大小: 208KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-07
  • 语言: C/C++
  • 标签: CAD    

资源简介

找了很久找到的一款仿CAD软件,原来是VC6.0开发的,现在我已经移植到了VS2015里面,功能方面支持直线,圆形,矩形,多边形的绘制;支持镜像,移动,复制,旋转等操作,不支持DXF,不支持图形的对齐,最多的特点是程序的界面很美观,适合在上面做扩展开发!

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “arc.h“
#include 
#include “SuperPoint.h“

void CArctool::OnLButtonDown(CPoint pointCDatemanage& datemanageCClientDC& dc)
{
switch( m_flag )
{
case NoClicked:
m_begPt = point;
m_oldPt = m_begPt;

m_line.OnLButtonDown(point);

m_flag = FirstClicked;
break;

case FirstClicked:
m_arcPt = point;
m_nRadius = sqrt((m_begPt.x-m_arcPt.x)*(m_begPt.x-m_arcPt.x)+(m_begPt.y-m_arcPt.y)*(m_begPt.y-m_arcPt.y));
m_flag = SecClicked;
break;

case SecClicked:
m_line.OnLButtonDown(point);

CPen hNewPen(20RGB(000));
dc.Selectobject(hNewPen);

dc.MoveTo(m_line.Getbegpt());
dc.LineTo(m_line.Getendpt());

m_endPt=point;


savetolist(datemanage);

CBrush newbrush(RGB(000));

dc.Selectobject(newbrush);

dc.Rectangle(0010241024);

if(datemanage.m_isnet)
{

datemanage.drawnet(dc);
}

datemanage.Reshow(dc);

m_flag = NoClicked;
break;

}
}


void CArctool::OnRButtonDown(CDatemanage& datemanageCClientDC& dc)
{

}


void CArctool::Draw(CClientDC& dc)
{
CPen hNewPen(m_penstylem_penwidthm_pencolor);
dc.Selectobject(hNewPen);
dc.SetROP2(R2_NOTXORPEN);

CRect rect;
    rect.left = m_begPt.x - m_nRadius;
rect.top = m_begPt.y - m_nRadius;
rect.right = m_begPt.x + m_nRadius;
rect.bottom = m_begPt.y + m_nRadius;

dc.Arc(rectm_oldPtm_arcPt);
dc.Arc(rectm_endPtm_arcPt);
}

void CArctool::onmousemove(CPoint pointCClientDC& dc)
{
POINT curPt;
curPt = point;
m_endPt = curPt;

switch( m_flag )
{
case NoClicked:
break;

case FirstClicked:
m_line.onmousemove(pointdc);
break;

case SecClicked:
m_line.onmousemove(pointdc);
Draw(dc);
break;
}

m_oldPt = m_endPt;
}



void CArctool::savetolist(CDatemanage& datemanage)
{
CSuperPoint ptpt1;
pt = m_begPt;
pt1 = m_endPt;
int Distance = pt1.DistanceTo(pt); 
CPoint pt2;
pt2.x = m_begPt.x + (((double)m_nRadius / (double)Distance) * (m_endPt.x - m_begPt.x));
pt2.y = m_begPt.y + (((double)m_nRadius / (double)Distance) * (m_endPt.y - m_begPt.y));



datemanage.Createlist();
    datemanage.gethead()->m_sHead->m_shape = new CShapearc();
datemanage.gethead()->m_sHead->m_shape->m_point[0] = m_begPt;
datemanage.gethead()->m_sHead->m_shape->m_point[1] = m_arcPt;

datemanage.gethead()->m_sHead->m_shape->m_point[2] = pt2;


datemanage.gethead()->m_sHead->m_shape->m_shape = shape_arc;
datemanage.gethead()->m_sHead->m_shape->m_penwidth = m_penwidth;
datemanage.gethead()->m_sHead->m_shape->m_pencolor = m_pencolor;
datemanage.gethead()->m_sHead->m_shape->m_penstyle = m_penstyle;
datemanage.gethead()->m_sHead->m_shape->m_nRadius = m_nRadius;

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     31744  2018-12-13 18:53  SCAD\.vs\CPP TEST\v14\.suo

     文件       2809  2006-03-24 11:19  SCAD\arc.cpp

     文件        553  2006-03-23 00:31  SCAD\arc.h

     文件        902  2018-12-13 16:55  SCAD\arraypoint.cpp

     文件        558  2018-12-13 16:55  SCAD\arraypoint.h

     文件       1562  2006-03-18 17:57  SCAD\catchtool.cpp

     文件        365  2006-03-11 20:52  SCAD\catchtool.h

     文件       1535  2006-03-15 13:58  SCAD\ChildFrm.cpp

     文件       1397  2006-03-15 13:58  SCAD\ChildFrm.h

     文件       2239  2006-03-22 12:28  SCAD\cirtool.cpp

     文件        344  2006-03-14 16:18  SCAD\cirtool.h

     文件       3460  2006-03-23 10:30  SCAD\copytool.cpp

     文件        348  2006-03-14 16:26  SCAD\copytool.h

     文件      39688  2018-12-13 16:51  SCAD\CPP TEST.APS

     文件       4878  2006-06-13 23:33  SCAD\CPP TEST.clw

     文件       4412  2006-03-15 13:58  SCAD\CPP TEST.cpp

     文件       9356  2006-03-27 15:12  SCAD\CPP TEST.dsp

     文件        541  2006-03-15 13:59  SCAD\CPP TEST.dsw

     文件       1370  2006-03-15 13:58  SCAD\CPP TEST.h

     文件     721920  2006-06-27 15:11  SCAD\CPP TEST.ncb

     文件      54784  2006-06-27 15:11  SCAD\CPP TEST.opt

     文件        250  2006-06-27 15:09  SCAD\CPP TEST.plg

     文件      18079  2006-03-27 15:12  SCAD\CPP TEST.rc

     文件        943  2018-12-13 16:51  SCAD\CPP TEST.sln

     文件      11148  2018-12-13 16:56  SCAD\CPP TEST.vcxproj

     文件       9711  2018-12-13 16:51  SCAD\CPP TEST.vcxproj.filters

     文件        165  2018-12-13 16:55  SCAD\CPP TEST.vcxproj.user

     文件       1765  2006-03-15 13:58  SCAD\CPP TESTDoc.cpp

     文件       1487  2006-03-15 13:58  SCAD\CPP TESTDoc.h

     文件      15538  2006-03-27 14:59  SCAD\CPP TESTView.cpp

............此处省略84个文件信息

评论

共有 条评论