資源簡介
ArcEngine實現畫點 畫面 畫線 C#

代碼片段和文件信息
////////by須臾蜉蝣////////
////////////////////////////////
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?ESRI.ArcGIS.Geometry;
using?ESRI.ArcGIS.Carto;
using?ESRI.ArcGIS.Geodatabase;
using?ESRI.ArcGIS.esriSystem;
using?ESRI.ArcGIS.Display;
using?ESRI.ArcGIS.SystemUI;
using?ESRI.ArcGIS.Controls;
namespace?DrawPoint
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????int?m_x?=?350;
????????int?m_y?=?350;
????????Random?m_r=?new?Random();
????????int?ranNumX;
????????int?ranNumY;
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????string?strPath?=?System.Windows.Forms.Application.StartupPath;//指定路徑
????????????axMapControl1.AddShapeFile(strPath?“Polygon“);//加載polygon的shp文件
????????????axMapControl1.AddShapeFile(strPath?“Polyline“);//加載polyline的shp文件
????????????axMapControl1.AddShapeFile(strPath?“Point“);//加載point的shp文件???????????
????????????//設置畫布大小
????????????IEnvelope?pEnvelope?=?new?EnvelopeClass();
????????????pEnvelope.PutCoords(0?0?600?600);
????????????axMapControl1.Extent?=?pEnvelope;
????????}
????????#region?生成點的三種方法
????????///?
????????///?1.直接在mapcontrol視窗中畫點,不能常駐
????????///?
????????private?void?DrawPoint()
????????{
????????????//獲得當前活動范圍
????????????IActiveView?pActiveView?=?axMapControl1.ActiveView;
????????????//開始畫筆?
????????????pActiveView.ScreenDisplay.StartDrawing(pActiveView.ScreenDisplay.hDC?(short)esriScreenCache.esriNoScreenCache);
????????????IPoint?pPoint;
????????????//定義簡單marker元素的標志
????????????ISimpleMarkerSymbol?pSymbol?=?new?SimpleMarkerSymbolClass();
????????????//設置顏色????????????
????????????IRgbColor?pRGBcolor?=?new?RgbColorClass();
????????????pRGBcolor.Red?=?255;
????????????pRGBcolor.Green?=?255;
????????????pRGBcolor.Blue?=?0;
????????????pSymbol.Color?=?pRGBcolor;
????????????//形狀為圓形
????????????pSymbol.style?=?esriSimpleMarkerstyle.esriSMSCircle;
????????????pSymbol.Size?=?15;
????????????pSymbol.Angle?=?270;
????????????
????????????//最后實現的時候要用ISymbol來實現,所以還是要做個轉換
????????????ISymbol?pPointSymbol?=?pSymbol?as?ISymbol;
????????????//該點是用來設置坐標的
????????????pPoint?=?new?PointClass();
????????????pPoint.PutCoords(300?300);
????????????
????????????pActiveView.ScreenDisplay.SetSymbol((ISymbol)pPointSymbol);
????????????pActiveView.ScreenDisplay.DrawPoint(pPoint);
????????????//結束畫筆
????????????pActiveView.ScreenDisplay.UpdateWindow();
????????????pActiveView.ScreenDisplay.FinishDrawing();
????????}
????????
????????///?
????????///?2.用element畫點
????????///?
????????private?void?DrawPointElement()
????????{
????????????//首先要實現容器接口
????????????IGraphicsContainer?pGraphicsContainer?=?axMapControl1.ActiveView?as?IGraphics
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????26112??2012-05-03?20:30??DrawAE\DrawPoint\bin\Debug\DrawPoint.exe
?????文件??????48640??2012-05-03?20:30??DrawAE\DrawPoint\bin\Debug\DrawPoint.pdb
?????文件??????11600??2012-05-03?20:38??DrawAE\DrawPoint\bin\Debug\DrawPoint.vshost.exe
?????文件????????490??2010-03-17?22:39??DrawAE\DrawPoint\bin\Debug\DrawPoint.vshost.exe.manifest
?????文件?????????66??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Point.dbf
?????文件????????148??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Point.sbn
?????文件????????116??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Point.sbx
?????文件????????100??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Point.shp
?????文件????????100??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Point.shx
?????文件?????????66??2012-05-03?20:31??DrawAE\DrawPoint\bin\Debug\Polygon.dbf
?????文件????????132??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polygon.sbn
?????文件????????116??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polygon.sbx
?????文件????????100??2012-05-03?20:31??DrawAE\DrawPoint\bin\Debug\Polygon.shp
?????文件????????100??2012-05-03?20:31??DrawAE\DrawPoint\bin\Debug\Polygon.shx
?????文件?????????66??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polyline.dbf
?????文件????????132??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polyline.sbn
?????文件????????116??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polyline.sbx
?????文件????????100??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polyline.shp
?????文件????????100??2012-05-03?20:29??DrawAE\DrawPoint\bin\Debug\Polyline.shx
?????文件????4558848??2012-02-01?00:08??DrawAE\DrawPoint\bin\DevComponents.DotNetBar2.dll
?????文件???????6267??2012-05-03?20:26??DrawAE\DrawPoint\DrawPoint.csproj
?????文件??????22039??2012-05-03?20:39??DrawAE\DrawPoint\Form1.cs
?????文件??????20085??2012-05-03?20:30??DrawAE\DrawPoint\Form1.Designer.cs
?????文件??????11499??2012-05-03?20:30??DrawAE\DrawPoint\Form1.resx
?????文件?????136240??2012-05-03?20:38??DrawAE\DrawPoint\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7329??2012-05-03?20:38??DrawAE\DrawPoint\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????2623??2012-05-03?20:38??DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.csproj.FileListAbsolute.txt
?????文件??????26112??2012-05-03?20:30??DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.exe
?????文件???????3956??2012-05-03?20:30??DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.Form1.resources
?????文件??????48640??2012-05-03?20:30??DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.pdb
............此處省略24個文件信息
評論
共有 條評論