---------------------------------------------------------------------------------------------------------
●·● 目录:
A1 ………… 实现:鼠标滑过显示要素 tip
A2 ………… 实现:通过鼠标选择要素并高亮显示(ISelectionEnvironment)
A3 ………… 实现:只显示筛选的要素(IFeatureLayerDefinition)
A4 ………… 实现:高亮显示筛选的要素(IFeatureSelection)
A5 ………… 实现:类似 ArcMap 中 Identify 工具的效果(IIdentify、IArray、IIdentifyObj)
A6 ………… 实现:在 MapControl 上绘制几何图形
实现:在 MapControl 上绘制几何图形(IGraphicsContainer,几何:圆)
A7 ………… 实现:在 MapControl 自由旋转地图(IScreenDisplay [RotateMoveTo])
实现:在 MapControl 中鼠标与地图反向移动(IScreenDisplay [PanMoveTo])
A8 ………… 实现:弹出颜色选择器(IColorPalette、IColorSelector、IColorBrowser)
实现:获取控件的屏幕位置(两种方法)
A9 ………… 实现:Symbol 对象(ISimpleMarkerSymbol、Arrow、Character、Picture)
G1 ………… 实现:Symbol 对象
G2 ………… 实现:显示图层的属性窗口
G3 ………… 实现:PageLayoutControl 的样式设置(IBorder、IBackground、IShadow、IMapGrid)
G4 ………… 实现:删除shapefile文件中的重复数据
G5 ………… 实现:MapControl 与 PageLayoutControl 的交互
G6 ………… 实现:制作可以浮动的工具栏
G7 ………… 实现:ArcGIS Engine 实现鹰眼 & 分析(IGraphicsContainer、IFillShapeElement)
G8 ………… 实现:独立窗口的鹰眼显示(IHookHelper)
G9 ………… 实现:自定义工具窗口(ICustomizeDialog、ICustomizeDialogEvents)
U1 ………… 实现:Map 与 PageLayout 切换后工具不变
U2 ………… 实现:在窗体中显示渐变颜色 & 根据名称获取控件(IAlgorithmicColorRamp、IEnumColor)
U3 ………… 实现:获取地图是否处于编辑状态(IDataset、IWorkspaceEdit)
U4 ………… 实现:为某一要素添加字段内容(IFeature)
U5 ………… 实现:获取地图是否处于编辑状态
U6 ………… 实现:获取地图是否处于编辑状态
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A1个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:鼠标滑过显示要素 tip:
对于这个有两个方法:
第一种:通过将 axmapcontrol 自带的 ShowMapTips 属性设置为 true 来实现。
第二种:通过 .NET 自带的控件 ToolTip 来实现!
第一种代码:
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
{
axMapControl1.ShowMapTips = true;
IFeatureLayer pFeatureLayer = axMapControl1.Map.get_Layer(0) as IFeatureLayer;
pFeatureLayer.DisplayField = "Name";
pFeatureLayer.ShowTips = true;
}
第二种代码:
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
{
IFeatureLayer pFeatureLayer = axMapControl1.Map.get_Layer(0) as IFeatureLayer;
pFeatureLayer.DisplayField = "Name";
pFeatureLayer.ShowTips = true;
string pTip;
pTip = pFeatureLayer.get_TipText(e.mapX, e.mapY, axMapControl1.ActiveView.FullExtent.Width / 10000);
if (pTip != null)
{
toolTip1.SetToolTip(axMapControl1, "名称:" + pTip);
}
else //当 ToolTip 空间显示的内容为 null 的时候,就不会显示了!相当于隐藏了!
{
toolTip1.SetToolTip(axMapControl1, "");
}
}
以上两种方法都可以实现显示标注,但是第二种效果更好一点~!
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A2个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:通过鼠标选择要素并高亮显示:
---------------------------------------------------------------------------------------------------------
●·● ISelectionEnvironment 接口:
---------------------------------------------------------------------------------------------------------
通过 IMap 接口的 SelectByShape 方法来实现!同时可以修改高亮显示的颜色!
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
IMap pMap = axMapControl1.Map;
IGeometry pGeometry = axMapControl1.TrackRectangle(); //获取框选几何
ISelectionEnvironment pSelectionEnv = new SelectionEnvironment(); //新建选择环境
IRgbColor pColor = new RgbColor();
pColor.Red = 255;
pSelectionEnv.DefaultColor = pColor; //设置高亮显示的颜色!
pMap.SelectByShape(pGeometry, pSelectionEnv, false); //选择图形!
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A3个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:只显示筛选的要素:
---------------------------------------------------------------------------------------------------------
●·● IFeatureLayerDefinition 接口:
---------------------------------------------------------------------------------------------------------
1. 通过 IFeatureLayerDefinition 接口的 DefinitionExpression 属性可以实现!
IFeatureLayer pFeatureLayer = axMapControl1.Map.get_Layer(0) as IFeatureLayer;
IFeatureLayerDefinition pFeatLyrDef = pFeatureLayer as IFeatureLayerDefinition; //新建 IFeatureLayerDefinition 接口实例
pFeatLyrDef.DefinitionExpression = "Area > 20"; //定义筛选条件
axMapControl1.ActiveView.Refresh(); //刷新
这样便只显示符合要求的部分了!即面积大于20的要素!
2. 通过 IFeatureLayerDefinition 接口的 CreatSelectionLayer 方法可以通过筛选建立新图层!
IFeatureLayer pFeatureLayer = axMapControl1.Map.get_Layer(0) as IFeatureLayer;
IFeatureLayerDefinition pFeatLyrDef = pFeatureLayer as IFeatureLayerDefinition;
pFeatLyrDef.DefinitionExpression = "Area > 20";
axMapControl1.ActiveView.Refresh(); //重新定义的图层
IQueryFilter pQueryFilter = new QueryFilter();
pQueryFilter.WhereClause = "POP > 10";
IFeatureSelection pFeatSel = pFeatureLayer as IFeatureSelection;
pFeatSel.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); //在新定义图层的基础上进行的查询
IFeatureLayer pNewFeat = pFeatLyrDef.CreateSelectionLayer("New Layer", true, null, null); //新建的图层包括上面两者的交集部分!
pFeatSel.Clear();
axMapControl1.Map.AddLayer(pNewFeat);
MessageBox.Show(axMapControl1.Map.LayerCount.ToString());
首先是建立一个虚拟的新图层,然后在此新图层的基础上进行筛选,然后从而生成新的图层!
参考:http://blog.csdn.net/qinyilang/article/details/6575539
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A4个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:高亮显示筛选的要素:
---------------------------------------------------------------------------------------------------------
●·● IFeatureSelection 接口:
---------------------------------------------------------------------------------------------------------
通过 IFeatureSelection 接口的 SelectFeatures 方法可以实现!
IFeatureLayer pFeatureLayer = axMapControl1.Map.get_Layer(0) as IFeatureLayer;
IQueryFilter pQueryFilter = new QueryFilter(); //建立查询
pQueryFilter.WhereClause = "POP > 10";
IFeatureSelection pFeatSel = pFeatureLayer as IFeatureSelection; //新建 IFeatureSelection 接口实例
pFeatSel.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false); //实现方法,选择筛选的部分!
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A5个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:类似 ArcMap 中 Identify 工具的效果:
---------------------------------------------------------------------------------------------------------
●·● IIdentify 接口:
---------------------------------------------------------------------------------------------------------
●·● IIdentifyObj 接口:
---------------------------------------------------------------------------------------------------------
●·● IArray 接口:
---------------------------------------------------------------------------------------------------------
主要实现点击查询并闪烁显示,并把查询要素的信息通过DataGridView显示出来,主要用到的接口:IIdentity、IArray、IIdentifyObj
IIdentify pIdentify = axMapControl1.Map.get_Layer(0) as IIdentify; //通过图层获取 IIdentify 实例
IPoint pPoint = new ESRI.ArcGIS.Geometry.Point(); //新建点来选择
IArray pIDArray;
IIdentifyObj pIdObj;
pPoint.PutCoords(e.mapX, e.mapY); //定义点
pIDArray = pIdentify.Identify(pPoint); //通过点获取数组,用点一般只能选择一个元素
if (pIDArray != null)
{
pIdObj = pIDArray.get_Element(0) as IIdentifyObj; //取得要素
pIdObj.Flash(axMapControl1.ActiveView.ScreenDisplay); //闪烁效果
MessageBox.Show("Layer: " + pIdObj.Layer.Name + "\n" + "Feature: " + pIdObj.Name); //输出信息
}
else
{
MessageBox.Show("Nothing!");
}
效果:
框选实现如下所示:
IIdentify pIdentify = axMapControl1.Map.get_Layer(0) as IIdentify;
IGeometry pGeo = axMapControl1.TrackRectangle() as IGeometry;
IArray pIDArray;
IIdentifyObj pIdObj;
pIDArray = pIdentify.Identify(pGeo);
if (pIDArray != null)
{
string str = "\n";
string lyrName = "";
for (int i = 0; i < pIDArray.Count;i++ )
{
pIdObj = pIDArray.get_Element(i) as IIdentifyObj;
pIdObj.Flash(axMapControl1.ActiveView.ScreenDisplay);
str += pIdObj.Name + "\n";
lyrName = pIdObj.Layer.Name;
}
MessageBox.Show("Layer: " + lyrName + "\n" + "Feature: " + str);
}
else
{
MessageBox.Show("Nothing!");
}
效果如下:
参考:http://blog.csdn.net/mjhwy/article/details/7337426
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A6个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:在 MapControl 上绘制几何图形:
可以直接使用 axMapControl1.DrawShape 方法来实现~!
ISimpleLineSymbol pLineSym = new SimpleLineSymbol();
IRgbColor pColor = new RgbColor();
pColor.Red = 11;
pColor.Green = 120;
pColor.Blue = 233;
pLineSym.Color = pColor;
pLineSym.Style = esriSimpleLineStyle.esriSLSSolid;
pLineSym.Width = 2;
IPolyline pLine = axMapControl1.TrackLine() as IPolyline;
object symbol = pLineSym as object;
axMapControl1.DrawShape(pLine, ref symbol);
也可以通过 IScreenDisplay 接口的方法来实现!~
ISimpleLineSymbol pLineSym = new SimpleLineSymbol();
IRgbColor pColor = new RgbColor();
pColor.Red = 11;
pColor.Green = 120;
pColor.Blue = 233;
pLineSym.Color = pColor;
pLineSym.Style = esriSimpleLineStyle.esriSLSSolid;
pLineSym.Width = 2;
IPolyline pLine = axMapControl1.TrackLine() as IPolyline;
IScreenDisplay pScreenDisplay = axMapControl1.ActiveView.ScreenDisplay;
pScreenDisplay.StartDrawing(pScreenDisplay.hDC, 1);
pScreenDisplay.SetSymbol(pLineSym as ISymbol);
pScreenDisplay.DrawPolyline(pLine);
pScreenDisplay.FinishDrawing();
通过比较,只是后面实现的部分不同,前面都是相同的!
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A6A个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:在 MapControl 上绘制几何图形(IGraphicsContainer,几何:圆):
普通的图形,可以直接向下面一样实现!
m_ActiveView = m_hookHelper.ActiveView; m_Map = m_hookHelper.FocusMap; IScreenDisplay pScreenDisplay = m_ActiveView.ScreenDisplay; IRubberBand pRubberPolygon = new RubberPolygonClass(); ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = getRGB(255, 255, 0); IPolygon pPolygon = pRubberPolygon.TrackNew(pScreenDisplay, (ISymbol)pFillSymbol) as IPolygon; pFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross; pFillSymbol.Color = getRGB(0, 255, 255); IFillShapeElement pPolygonEle = new PolygonElementClass(); pPolygonEle.Symbol = pFillSymbol; IElement pEle = pPolygonEle as IElement; pEle.Geometry = pPolygon; IGraphicsContainer pGraphicsContainer = m_Map as IGraphicsContainer; pGraphicsContainer.AddElement(pEle, 0); m_ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
画圆比较特殊,因为没有圆这个现成的几何体,因此要转换,如下所示:
m_ActiveView = m_hookHelper.ActiveView; m_Map = m_hookHelper.FocusMap; IScreenDisplay pScreenDisplay = m_ActiveView.ScreenDisplay; IRubberBand pRubberCircle = new RubberCircleClass(); ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = getRGB(255, 255, 0); IGeometry pCircle = pRubberCircle.TrackNew(pScreenDisplay, (ISymbol)pFillSymbol) as IGeometry; IPolygon pPolygon = new PolygonClass(); //空的多边形 ISegmentCollection pSegmentCollection = pPolygon as ISegmentCollection; //段集合 ISegment pSegment = pCircle as ISegment; //将圆赋值给段 object missing = Type.Missing; //显示默认值 pSegmentCollection.AddSegment(pSegment, ref missing, ref missing); //给空多边形加入圆 pFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross; pFillSymbol.Color = getRGB(0, 255, 255); IFillShapeElement pPolygonEle = new PolygonElementClass(); pPolygonEle.Symbol = pFillSymbol; IElement pEle = pPolygonEle as IElement; pEle.Geometry = pPolygon; IGraphicsContainer pGraphicsContainer = m_Map as IGraphicsContainer; pGraphicsContainer.AddElement(pEle, 0); m_ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A7个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:在 MapControl 自由旋转地图:
---------------------------------------------------------------------------------------------------------
●·● IScreenDisplay 接口:
---------------------------------------------------------------------------------------------------------
通过 IScreenDisplay 接口来实现!
//鼠标按下!
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
IPoint pCentrePoint = new PointClass();
pCentrePoint.PutCoords(axMapControl1.Extent.XMin + axMapControl1.ActiveView.Extent.Width / 2,
axMapControl1.Extent.YMax - axMapControl1.ActiveView.Extent.Height / 2); //获取图像的中心位置
axMapControl1.ActiveView.ScreenDisplay.RotateStart(pPoint, pCentrePoint); //开始旋转
}
//鼠标移动!
private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
axMapControl1.ActiveView.ScreenDisplay.RotateMoveTo(pPoint); //旋转到鼠标的位置
axMapControl1.ActiveView.ScreenDisplay.RotateTimer(); //可以忽略
}
//鼠标抬起!
private void axMapControl1_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
{
double dRotationAngle = axMapControl1.ActiveView.ScreenDisplay.RotateStop(); //获取旋转的角度
axMapControl1.Rotation = dRotationAngle; //赋值给 axMapControl1.Rotation,这下真的旋转了!
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); //刷新!
}
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A7A个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:在 MapControl 中鼠标与地图反向移动:
double startMapX = 0; double startMapY = 0; IScreenDisplay pScreenDisplay; private void Form1_Load(object sender, EventArgs e) //窗体加载信息 { pScreenDisplay = axMapControl1.ActiveView.ScreenDisplay; } private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) //鼠标按下的时候触发 { IPoint pPoint = new PointClass(); pPoint.PutCoords(e.mapX, e.mapY); pScreenDisplay.PanStart(pPoint); startMapY = e.mapY; startMapX = e.mapX; } private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) //鼠标移动的时候触发 { IPoint pPoint = new PointClass(); pPoint.PutCoords(startMapX * 2 - e.mapX, startMapY * 2 - e.mapY); //获取当前点关于起始点的对称点 pScreenDisplay.PanMoveTo(pPoint); } private void axMapControl1_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e) //鼠标松开的时候触发 { pScreenDisplay.PanStop(); }
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A8个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:弹出颜色选择器:
---------------------------------------------------------------------------------------------------------
●·● IColorPalette 接口:
---------------------------------------------------------------------------------------------------------
1. ColorPalette:
private void button1_Click(object sender, EventArgs e) { IColor pColor = new RgbColor(); pColor.RGB = 255; tagRECT pTag = new tagRECT(); pTag.left = this.Left + button1.Left + button1.Width; pTag.bottom = this.Top + button1.Top + button1.Height; IColorPalette pColorPalette = new ColorPalette(); pColorPalette.TrackPopupMenu(ref pTag, pColor, false, 0); pColor = pColorPalette.Color; }
效果:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A8A个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:获取控件的屏幕位置(两种方法):
第一种:将控件坐标转换为屏幕坐标!
pTag.left = button1.PointToScreen(System.Drawing.Point.Empty).X;
pTag.bottom = button1.PointToScreen(System.Drawing.Point.Empty).Y + button1.Height;
第二种:通过空间之间属性的间接计算!注:button1 在 groupBox2 中!
pTag.left = SystemInformation.FrameBorderSize.Width + this.Left + groupBox2.Left + button1.Left; pTag.bottom = (this.Height - this.ClientRectangle.Height - SystemInformation.FrameBorderSize.Height) + this.Top + groupBox2.Top + button1.Top + button1.Height;
---------------------------------------------------------------------------------------------------------
●·● IColorSelector 接口:
---------------------------------------------------------------------------------------------------------
2. ColorSelector:
IColor pColor = new RgbColor(); pColor.RGB = 255; IColorSelector pSelector = new ColorSelectorClass(); pSelector.Color = pColor; if (pSelector.DoModal(0)) { pColor = pSelector.Color; }
效果:
---------------------------------------------------------------------------------------------------------
●·● IColorBrowser 接口:
---------------------------------------------------------------------------------------------------------
3. ColorBrowser:
IColor pColor = new RgbColor(); pColor.RGB = 255; IColorBrowser pColorBrowser = new ColorBrowser(); pColorBrowser.Color = pColor; if (pColorBrowser.DoModal(0)) { pColor = pColorBrowser.Color; }
效果:
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A9个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:颜色台(Color Ramp):
---------------------------------------------------------------------------------------------------------
●·● IAlgorithmicColorRamp 接口:
---------------------------------------------------------------------------------------------------------
1. AlgorithmicColorRamp:
定义函数:
private IEnumColors CreateColorRamp(IColor fromColor,IColor toColor,int count) { IAlgorithmicColorRamp pRampColor = new AlgorithmicColorRamp(); pRampColor.FromColor = fromColor; pRampColor.ToColor = toColor; pRampColor.Size = count; bool ok = false; pRampColor.CreateRamp(out ok); if (ok) { return pRampColor.Colors; } else { return null; } }
调用函数:颜色在 red 和 violet 之间变化!
private void timer1_Tick(object sender, EventArgs e) { IRgbColor fromColor = new RgbColor(); fromColor.Red = 255; IRgbColor toColor = new RgbColor(); toColor.Red = 128; toColor.Blue = 255; IEnumColors pEnumColors = CreateColorRamp(fromColor, toColor, 50); IColor pColor = null; for (int i = 0; i < count;i++ ) { pColor = pEnumColors.Next(); } if (count == 50) { count = 0; timer1.Enabled = false; timer2.Enabled = true; } count++; axPageLayoutControl1.PageLayout.Page.BackgroundColor = pColor; } private void timer2_Tick(object sender, EventArgs e) { IRgbColor fromColor = new RgbColor(); fromColor.Red = 128; fromColor.Blue = 255; IRgbColor toColor = new RgbColor(); toColor.Red = 255; IEnumColors pEnumColors = CreateColorRamp(fromColor, toColor, 20); IColor pColor = null; for (int i = 0; i < count; i++) { pColor = pEnumColors.Next(); } if (count == 20) { count = 0; timer2.Enabled = false; timer1.Enabled = true; } count++; axPageLayoutControl1.PageLayout.Page.BackgroundColor = pColor; }
---------------------------------------------------------------------------------------------------------
●·● IRandomColorRamp 接口:
---------------------------------------------------------------------------------------------------------
2. RandomColorRamp:
定义函数:
private IColor CreateRandomColorRamp() { IRandomColorRamp pRandomColor = new RandomColorRamp(); pRandomColor.StartHue = 140; pRandomColor.EndHue = 220; pRandomColor.MinValue = 35; pRandomColor.MaxValue = 100; pRandomColor.MinSaturation = 32; pRandomColor.MaxSaturation = 100; pRandomColor.Size = 12; pRandomColor.Seed = 7; bool ok = true; pRandomColor.CreateRamp(out ok); IEnumColors pEnumColors = pRandomColor.Colors; IColor pColor = pEnumColors.Next(); return pColor; }
调用函数
private void button5_Click(object sender, EventArgs e) { IColor pColor = CreateRandomColorRamp(); axPageLayoutControl2.PageLayout.Page.BackgroundColor = pColor; }
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第G1个 ╠══════════════════════════════════════════════════╣
╚════════╝
●·● 实现:Symbol 对象:
---------------------------------------------------------------------------------------------------------
●·● ISimpleMarkerSymbol 接口:
---------------------------------------------------------------------------------------------------------
1. SimpleMarkerSymbol:
新建工具!
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using System.Windows.Forms;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry; namespace Symbol
{
/// <summary>
/// Summary description for Tool1.
/// </summary>
[Guid("63835a8e-ae77-4817-b4e4-3b120b5232f9")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("Symbol.Tool1")]
public sealed class Tool1 : BaseTool
{
#region COM Registration Function(s)
[ComRegisterFunction()]
[ComVisible(false)]
static void RegisterFunction(Type registerType)
{
// Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType);//
// TODO: Add any COM registration code here
//
}[ComUnregisterFunction()]
false)]
[ComVisible(
static void UnregisterFunction(Type registerType)
{
// Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType);//
// TODO: Add any COM unregistration code here
//
}#region ArcGIS Component Category Registrar generated code
/// <summary>
/// Required method for ArcGIS Component Category registration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryRegistration(Type registerType)
{
string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
ControlsCommands.Register(regKey);}
/// <summary>
/// Required method for ArcGIS Component Category unregistration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryUnregistration(Type registerType)
{
string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
ControlsCommands.Unregister(regKey);}
#endregion
#endregion
//---------------------------------------------------------------------------------------------------------
private IHookHelper m_hookHelper = null;
private IMapControl4 pMapControl;
//---------------------------------------------------------------------------------------------------------
public Tool1()
{
//
// TODO: Define values for the public properties
//
base.m_category = "