資源簡(jiǎn)介
這是一個(gè)用c#面向?qū)ο蟪绦蛟O(shè)計(jì)的畫圖軟件,有很多的備注能是人明白

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Drawing;
namespace?CAD
{
????[Serializable]
????public?abstract?class?baseShape
????{
????????private?bool?isSelected?=?false;//標(biāo)識(shí)圖形是否被選中
????????
????????private?Point?p1;//第一個(gè)點(diǎn)
????????private?Point?p2;//第二個(gè)點(diǎn)
????????public??Color?penColor;
????????public??int?penwidth?;
????????public?void?setSelected()//設(shè)置為選中狀態(tài)
????????{
????????????this.isSelected?=?true;
????????}
????????public?void?setUnSelected()//設(shè)置為非選中狀態(tài)
????????{
????????????this.isSelected?=?false;
????????}
????????public?Point?getP1()
????????{
????????????return?p1;
????????}
????????public?void?setP1(Point?p1)
????????{
????????????this.p1?=?p1;
????????}
????????public?Point?getP2()
????????{
????????????return?p2;
????????}
????????public?void?setP2(Point?p2)
????????{
????????????this.p2?=?p2;
????????}
????????public?abstract?void?draw(Graphics?g);//畫圖形
????????public?abstract?Point[]?getAllHitPoint();//得到所有圖形
????????public?abstract?void?setHitPoint(int?hitPointIndex?Point?newPoint);//設(shè)定熱點(diǎn)
????????public?abstract?baseShape?copySelf();//復(fù)制
????????public?bool?catchHitPoint(Point?hitPoint?Point?testPoint)//測(cè)試熱點(diǎn)捕捉
????????{
????????????return?this.getHitPointRectangle(hitPoint).Contains(testPoint);
????????}
????????public?int?catchShapPoint(Point?testPoint)//捕捉圖形
????????{
????????????int?hitPointIndex?=?-1;
????????????Point[]?allHitPoint?=?this.getAllHitPoint();//的到所有的熱點(diǎn)
????????????for?(int?i?=?0;?i?????????????{
????????????????if?(this.catchHitPoint(allHitPoint[i]?testPoint))
????????????????{
????????????????????return?i?+?1;//如果捕捉到了熱點(diǎn),返回?zé)狳c(diǎn)的索引
????????????????}
????????????}
????????????if(this.catchShape(testPoint))?return?0;//沒有捕捉到熱點(diǎn),捕捉到了圖形,返回特別熱點(diǎn)
????????????return?hitPointIndex;//返回捕捉到的人點(diǎn)
????????????}
????????public?void?drawHitPoint(Point?hitPoint?Graphics?g)//畫熱點(diǎn)
????????{
????????????g.DrawRectangle(new?Pen(Color.Red1)?this.getHitPointRectangle(hitPoint));
????????}
????????public?void?drawAllHitPoint(Graphics?g)//畫所有熱點(diǎn)
????????{
????????????Point[]?allHitPoint=this.getAllHitPoint();
????????????for(int?i=0;i<2;i++)
????????????{
????????????????this.drawHitPoint(allHitPoint[i]g);
????????????}
????????}
????????public?Rectangle?getHitPointRectangle(Point?hitPoint)//得到熱點(diǎn)矩形,以熱點(diǎn)為中心高寬5像素的矩形
????????{
????????????Rectangle?rect=new?Rectangle();
????????????rect.X=hitPoint.X-2;
????????????rect.Y=hitPoint.Y-2;
????????????rect.Width=5;
????????????rect.Height=5;
????????????return?rect;
????????}
????????public?abstract?bool?catchShape(Point?testPoint);//圖形捕捉
????????public?void?superDraw(Graphics?g)//公共畫法
????????{
????????????if(this.isSelected)?this.drawAllHitPoint(g);
????????}
????????public?static?Pen?getPen(CADframe?objCAD)//得到畫筆
????????{
????????????return?new?Pen(objCAD.clrobjCAD.lineWidth);
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????899??2012-06-21?15:04??CAD\CAD.sln
????..A..H.?????47104??2012-07-04?17:50??CAD\CAD.suo
?????文件???????6033??2012-06-21?15:04??CAD\UpgradeLog.xm
?????文件??????27136??2003-01-01?07:40??CAD\實(shí)訓(xùn)報(bào)告和總結(jié)\實(shí)訓(xùn)報(bào)告.doc
?????文件??????14848??2003-01-01?07:22??CAD\實(shí)訓(xùn)報(bào)告和總結(jié)\自評(píng)表.xls
?????文件???????3348??2012-06-21?15:04??CAD\_UpgradeReport_Files\UpgradeReport.css
?????文件??????12505??2010-05-04?01:19??CAD\_UpgradeReport_Files\UpgradeReport.xslt
?????文件?????????69??2012-06-21?15:04??CAD\_UpgradeReport_Files\UpgradeReport_Minus.gif
?????文件?????????71??2012-06-21?15:04??CAD\_UpgradeReport_Files\UpgradeReport_Plus.gif
?????文件???????3132??2012-07-02?21:15??CAD\CAD\ba
?????文件???????4823??2011-11-27?02:02??CAD\CAD\ba
?????文件???????4119??2012-06-21?15:04??CAD\CAD\CAD.csproj
?????文件??????16340??2012-07-02?21:44??CAD\CAD\CADfr
?????文件??????22624??2012-07-02?21:44??CAD\CAD\CADfr
?????文件???????6621??2012-07-02?21:44??CAD\CAD\CADfr
?????文件???????2989??2011-11-27?02:02??CAD\CAD\CircleShape.cs
?????文件???????1181??2011-11-27?02:02??CAD\CAD\CircleTool.cs
?????文件???????6674??2011-11-27?02:02??CAD\CAD\EllipseShape.cs
?????文件???????1184??2011-11-27?02:02??CAD\CAD\EllipseTool.cs
?????文件???????3822??2011-11-27?02:02??CAD\CAD\HandTool.cs
?????文件???????3029??2011-11-27?02:02??CAD\CAD\LineShape.cs
?????文件???????1177??2011-11-27?02:02??CAD\CAD\LineTool.cs
?????文件????????465??2011-11-27?02:02??CAD\CAD\Program.cs
?????文件???????7335??2011-11-27?02:02??CAD\CAD\RectangleShape.cs
?????文件???????1188??2011-11-27?02:02??CAD\CAD\RectangleTool.cs
?????文件???????1162??2011-11-27?02:02??CAD\CAD\Properties\AssemblyInfo.cs
?????文件???????2844??2012-06-21?15:04??CAD\CAD\Properties\Resources.Designer.cs
?????文件???????5612??2011-11-27?02:02??CAD\CAD\Properties\Resources.resx
?????文件???????1101??2012-06-21?15:04??CAD\CAD\Properties\Settings.Designer.cs
?????文件????????249??2011-11-27?02:02??CAD\CAD\Properties\Settings.settings
............此處省略56個(gè)文件信息
評(píng)論
共有 條評(píng)論