ArcEngine二次开发_03(鼠标在图层中选择要素进行高亮显示)
2018-02-07 01:55
645 查看
首先这个功能还是比较常用到的,至少我是这么觉得的。
然后写的话,是在axMapConTroll_onMouseDown事件中来进行的
接下来是它的代码:
#region 鼠标在图层中选择要素进行高亮显示
/*用到的接口: IMap:Provide access to Members that control the map;
IGometry: Provides access to members that describe properties and behavior of all geometric objects;
ISelectionEnvironment: Provides access to members that control the selection environment.
IRgbColor: Provides access to members that control the RGB color values.
*/
private void XMMapControl_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
XMMapControl.MousePointer = esriControlsMousePointer.esriPointerDefault;
IMap pMap = XMMapControl.Map;
IGeometry pGeometry = XMMapControl.TrackRectangle(); //获取几何图框范围
ISelectionEnvironment pSelectionEnv = new SelectionEnvironment(); //新建选择环境
IRgbColor pColor = new RgbColor();
pColor.Red = 232; //调整高亮显示的颜色
pSelectionEnv.DefaultColor = pColor; //设置高亮显示的颜色
pMap.SelectByShape(pGeometry, pSelectionEnv, false); //选择图形SelectByShape方法
XMMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); //刷新图层
}
#endregion这段代码注释比较多,方便大家理解,希望对大家有帮助,毕竟写下来记得牢。
然后写的话,是在axMapConTroll_onMouseDown事件中来进行的
接下来是它的代码:
#region 鼠标在图层中选择要素进行高亮显示
/*用到的接口: IMap:Provide access to Members that control the map;
IGometry: Provides access to members that describe properties and behavior of all geometric objects;
ISelectionEnvironment: Provides access to members that control the selection environment.
IRgbColor: Provides access to members that control the RGB color values.
*/
private void XMMapControl_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
XMMapControl.MousePointer = esriControlsMousePointer.esriPointerDefault;
IMap pMap = XMMapControl.Map;
IGeometry pGeometry = XMMapControl.TrackRectangle(); //获取几何图框范围
ISelectionEnvironment pSelectionEnv = new SelectionEnvironment(); //新建选择环境
IRgbColor pColor = new RgbColor();
pColor.Red = 232; //调整高亮显示的颜色
pSelectionEnv.DefaultColor = pColor; //设置高亮显示的颜色
pMap.SelectByShape(pGeometry, pSelectionEnv, false); //选择图形SelectByShape方法
XMMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); //刷新图层
}
#endregion这段代码注释比较多,方便大家理解,希望对大家有帮助,毕竟写下来记得牢。
相关文章推荐
- ArcEngine二次开发_02(鼠标移过图层中显示特定的属性信息)
- ArcEngine二次开发_04(鼠标点击图层点显示属性(两个及以上))
- C# ArcgisEngine开发中,对一个图层进行过滤,只显示符合条件的要素
- ArcgisEngine+C#开发中,对一个图层进行过滤,并只显示符合条件的要素
- C#+AE(ArcEngine)二次开发:通过点击选择面状要素并计算其面积
- solidworks二次开发:选择命名实体,高亮显示
- 【转】C# ArcgisEngine开发中,对一个图层进行过滤,只显示符合条件的要素
- arcgis for android 学习 - (6) 属性查询。检索图层上某个要素,并高亮显示它。
- arcgis for android 学习 - 属性查询。检索图层上某个要素,并高亮显示它。
- FlexPaper二次开发问题及搜索高亮显示
- C#进行MapX二次开发之图层操作
- Revit 2011 二次开发之“高亮显示错误提示”
- arcengine 经典代码(转) 空间查询 在一个图层上画一个polygon,根据该polygon查询出图层上与之相交的polygon并高亮显示出来
- 在ASP.NET的DataGrid中,鼠标点击某行进行高亮显示的解决方案
- arcgis for android 学习 - (6) 属性查询。检索图层上某个要素,并高亮显示它。
- 【已测试通过】::自定义工具按钮进行矩选查询,高亮显示所选择的地图要素
- C#进行MapX二次开发之图层操作
- Revit 2011 二次开发之“高亮显示错误提示”
- 用VC进行MapX二次开发响应鼠标消息
- ArcGIS API for Silverlight之Web Mapping开发:根据图层属性查询、定位、高亮显示