資源簡介
繪制站場簡圖
代碼片段和文件信息
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??Color?penColor;
????????public??int?penwidth?;
????????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?newPoint);//設定熱點
????????public?abstract?baseShape?copySelf();//復制
????????public?bool?catchHitPoint(Point?hitPoint?Point?testPoint)//測試熱點捕捉
????????{
????????????return?this.getHitPointRectangle(hitPoint).Contains(testPoint);
????????}
????????public?int?catchShapPoint(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(new?Pen(Color.Red1)?this.getHitPointRectangle(hitPoint));
????????}
????????public?void?drawAllHitPoint(Graphics?g)//畫所有熱點
????????{
????????????Point[]?allHitPoint=this.getAllHitPoint();
????????????for(int?i=0;i<2;i++)
????????????{
????????????????this.drawHitPoint(allHitPoint[i]g);
????????????}
????????}
????????public?Rectangle?getHitPointRectangle(Point?hitPoint)//得到熱點矩形,以熱點為中心高寬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);
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-01-19?21:47??tCADtest1.2\
?????目錄???????????0??2019-01-21?02:11??tCADtest1.2\CAD\
?????目錄???????????0??2019-01-20?18:38??tCADtest1.2\CAD\.vs\
?????目錄???????????0??2019-01-18?23:39??tCADtest1.2\CAD\.vs\CAD\
?????目錄???????????0??2019-01-18?23:39??tCADtest1.2\CAD\.vs\CAD\v15\
?????文件???????84992??2019-01-19?11:43??tCADtest1.2\CAD\.vs\CAD\v15\.suo
?????目錄???????????0??2019-01-18?23:39??tCADtest1.2\CAD\.vs\CAD\v15\Server\
?????目錄???????????0??2019-01-18?23:39??tCADtest1.2\CAD\.vs\CAD\v15\Server\sqlite3\
?????文件???????????0??2019-01-12?19:39??tCADtest1.2\CAD\.vs\CAD\v15\Server\sqlite3\db.lock
?????文件??????557056??2019-01-19?03:55??tCADtest1.2\CAD\.vs\CAD\v15\Server\sqlite3\storage.ide
?????文件???????32768??2019-01-19?11:43??tCADtest1.2\CAD\.vs\CAD\v15\Server\sqlite3\storage.ide-shm
?????文件?????4144752??2019-01-19?11:43??tCADtest1.2\CAD\.vs\CAD\v15\Server\sqlite3\storage.ide-wal
?????目錄???????????0??2019-01-19?11:44??tCADtest1.2\CAD\.vs\tCADtest1.1\
?????目錄???????????0??2019-01-19?11:46??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\
?????文件???????54784??2019-01-20?18:37??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\.suo
?????目錄???????????0??2019-01-19?11:44??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\Server\
?????目錄???????????0??2019-01-19?11:44??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\Server\sqlite3\
?????文件???????????0??2019-01-19?11:44??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\Server\sqlite3\db.lock
?????文件??????503808??2019-01-20?18:17??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\Server\sqlite3\storage.ide
?????文件???????32768??2019-01-20?18:35??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\Server\sqlite3\storage.ide-shm
?????文件?????4136512??2019-01-20?18:37??tCADtest1.2\CAD\.vs\tCADtest1.1\v15\Server\sqlite3\storage.ide-wal
?????目錄???????????0??2019-01-20?18:38??tCADtest1.2\CAD\.vs\tCADtest1.2\
?????目錄???????????0??2019-01-20?18:39??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\
?????文件???????73216??2019-01-24?22:48??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\.suo
?????目錄???????????0??2019-01-20?18:38??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\Server\
?????目錄???????????0??2019-01-20?18:38??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\Server\sqlite3\
?????文件???????????0??2019-01-20?18:38??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\Server\sqlite3\db.lock
?????文件?????1114112??2019-01-24?22:07??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\Server\sqlite3\storage.ide
?????文件???????32768??2019-01-24?20:47??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\Server\sqlite3\storage.ide-shm
?????文件?????4144752??2019-01-24?22:48??tCADtest1.2\CAD\.vs\tCADtest1.2\v15\Server\sqlite3\storage.ide-wal
?????目錄???????????0??2019-01-18?23:39??tCADtest1.2\CAD\Backup\
............此處省略140個文件信息
- 上一篇:C# 影院電影售票系統
- 下一篇:c#向網頁推送消息
評論
共有 條評論