資源簡介
對編寫畫圖軟件有幫助哦!全部代碼都是用C#編寫的,對于初學者很有用的哦!

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Drawing;
namespace?CAD
{
????[Serializable]
????public?abstract?class?baseShape
????{????????
????????private?bool?isSelected?=?false;
????????private?Point?p1;
????????private?Point?p2;
????????public?void?setSelected()
????????{
????????????this.isSelected?=?true;
????????}
????????public?void?setUnSelected()
????????{
????????????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?newPiont);
????????public?abstract?baseShape?copySelf();
????????public?bool?catchHitPoint(Point?hitPoint?Point?testPoint)
????????{
????????????return?this.getHitPointRectangle(hitPoint).Contains(testPoint);
????????}
????????public?int?catchShapePoint(Point?testPoint)
????????{
????????????int?hitPointIndex?=?-1;
????????????Point[]?allHitPoint?=?this.getAllHitPoint();
????????????for?(int?i?=?0;?i?????????????{
????????????????if?(this.catchHitPoint(allHitPoint[i]?testPoint))
????????????????{
????????????????????return?i?+?1;
????????????????}
????????????}
????????????if?(this.catchShape(testPoint))?return?0;
????????????return?hitPointIndex;
????????}
????????public?void?drawHitPoint(Point?hitPoint?Graphics?g)
????????{
????????????g.DrawRectangle(baseShape.getPen()?this.getHitPointRectangle(hitPoint));
????????}
????????public?void?drawAllHitPoinit(Graphics?g)
????????{
????????????Point[]?allHitPoint?=?this.getAllHitPoint();
????????????for?(int?i?=?0;?i?????????????{
????????????????this.drawHitPoint(allHitPoint[i]?g);
????????????}
????????}
????????public?Rectangle?getHitPointRectangle(Point?hitPoint)
????????{
????????????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)
????????{
????????????this.draw(g);
????????????if?(this.isSelected)?this.drawAllHitPoinit(g);
????????}
????????public?static?Pen?getPen()
????????{
????????????return?new?Pen(Color.Black);
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2756??2008-08-27?15:08??CAD\CAD\ba
?????文件???????4147??2008-08-28?16:13??CAD\CAD\ba
?????文件??????28672??2008-08-28?16:55??CAD\CAD\bin\Debug\CAD.exe
?????文件??????65024??2008-08-28?16:55??CAD\CAD\bin\Debug\CAD.pdb
?????文件???????5632??2005-12-08?14:51??CAD\CAD\bin\Debug\CAD.vshost.exe
?????文件???????3425??2008-08-27?16:06??CAD\CAD\CAD.csproj
?????文件???????7910??2008-08-28?16:50??CAD\CAD\CADfr
?????文件???????7751??2008-08-28?16:27??CAD\CAD\CADfr
?????文件???????6221??2008-08-28?16:27??CAD\CAD\CADfr
?????文件???????3195??2008-08-27?16:36??CAD\CAD\HandTool.cs
?????文件???????2639??2008-08-28?16:55??CAD\CAD\LineShape.cs
?????文件???????1051??2008-08-28?15:29??CAD\CAD\LineTool.cs
?????文件????????419??2008-08-28?16:56??CAD\CAD\obj\CAD.csproj.FileListAbsolute.txt
?????文件????????180??2008-08-28?16:27??CAD\CAD\obj\Debug\CAD.CADfr
?????文件????????845??2008-08-28?16:27??CAD\CAD\obj\Debug\CAD.csproj.GenerateResource.Cache
?????文件??????28672??2008-08-28?16:55??CAD\CAD\obj\Debug\CAD.exe
?????文件??????65024??2008-08-28?16:55??CAD\CAD\obj\Debug\CAD.pdb
?????文件????????180??2008-08-28?16:07??CAD\CAD\obj\Debug\CAD.Properties.Resources.resources
?????文件????????465??2008-08-27?14:43??CAD\CAD\Program.cs
?????文件???????1162??2008-08-27?14:24??CAD\CAD\Properties\AssemblyInfo.cs
?????文件???????2862??2008-08-27?14:24??CAD\CAD\Properties\Resources.Designer.cs
?????文件???????5612??2008-08-27?14:24??CAD\CAD\Properties\Resources.resx
?????文件???????1088??2008-08-27?14:24??CAD\CAD\Properties\Settings.Designer.cs
?????文件????????249??2008-08-27?14:24??CAD\CAD\Properties\Settings.settings
?????文件????????898??2008-08-27?14:24??CAD\CAD.sln
????..A..H.?????15872??2008-08-28?15:04??CAD\CAD.suo
?????目錄??????????0??2008-08-27?14:43??CAD\CAD\obj\Debug\Refactor
?????目錄??????????0??2008-08-27?14:24??CAD\CAD\obj\Debug\TempPE
?????目錄??????????0??2008-08-28?16:13??CAD\CAD\bin\Debug
?????目錄??????????0??2008-08-28?16:55??CAD\CAD\obj\Debug
............此處省略8個文件信息
評論
共有 條評論