1个回答
展开全部
实现:通过鼠标选择要素并高亮显示:
---------------------------------------------------------------------------------------------------------
●·● 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);
}
---------------------------------------------------------------------------------------------------------
●·● 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);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询