ArcEngine二次开发_04(鼠标点击图层点显示属性(两个及以上))
2018-03-12 19:17
330 查看
首先,这个功能之前有琢磨了一段时间,分享给大家,谢谢各位朋友们 private void mainMapControl_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
if (mainMapControl.LayerCount > 0) //判断是否在axMapControl上加载图层
{
IFeatureLayer pFeatureLayer = mainMapControl.Map.get_Layer(0) as IFeatureLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
string tipId = null;
string tipSector = null;
int num = pFeatureClass.Fields.FieldCount;
for (int i = 0; i < num; i++)
{
string filedName = pFeatureClass.Fields.get_Field(i).Name; //用于遍历属性名
if (filedName == "BTS_ID")
{
pFeatureLayer.DisplayField = filedName;
tipId = pFeatureLayer.get_TipText(e.mapX, e.mapY, mainMapControl.ActiveView.FullExtent.Width / 10000);
}
if (filedName == "1X_Sector_")
{
pFeatureLayer.DisplayField = filedName;
tipSector = pFeatureLayer.get_TipText(e.mapX, e.mapY, mainMapControl.ActiveView.FullExtent.Width / 10000);
}
}
pFeatureLayer.ShowTips = true;
string pTip;
pTip = tipId + " _ " + tipSector;
if (pTip != null) // 判断pTip内容是否为空
{
toolTip1.SetToolTip(mainMapControl, pTip); //需先添加tooltip控件:当用户移动关联控件时显示信息
}
else
{
toolTip1.SetToolTip(mainMapControl, "");
}
}
else
return;
}接下来看一下显示效果吧哈哈哈哈
{
if (mainMapControl.LayerCount > 0) //判断是否在axMapControl上加载图层
{
IFeatureLayer pFeatureLayer = mainMapControl.Map.get_Layer(0) as IFeatureLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
string tipId = null;
string tipSector = null;
int num = pFeatureClass.Fields.FieldCount;
for (int i = 0; i < num; i++)
{
string filedName = pFeatureClass.Fields.get_Field(i).Name; //用于遍历属性名
if (filedName == "BTS_ID")
{
pFeatureLayer.DisplayField = filedName;
tipId = pFeatureLayer.get_TipText(e.mapX, e.mapY, mainMapControl.ActiveView.FullExtent.Width / 10000);
}
if (filedName == "1X_Sector_")
{
pFeatureLayer.DisplayField = filedName;
tipSector = pFeatureLayer.get_TipText(e.mapX, e.mapY, mainMapControl.ActiveView.FullExtent.Width / 10000);
}
}
pFeatureLayer.ShowTips = true;
string pTip;
pTip = tipId + " _ " + tipSector;
if (pTip != null) // 判断pTip内容是否为空
{
toolTip1.SetToolTip(mainMapControl, pTip); //需先添加tooltip控件:当用户移动关联控件时显示信息
}
else
{
toolTip1.SetToolTip(mainMapControl, "");
}
}
else
return;
}接下来看一下显示效果吧哈哈哈哈
相关文章推荐
- ArcEngine二次开发_02(鼠标移过图层中显示特定的属性信息)
- ArcEngine二次开发_03(鼠标在图层中选择要素进行高亮显示)
- QGis二次开发基础 -- 矢量图层属性图表显示
- ArcEngine开发 TOCC中“图层”标记不显示问题
- Java OpenCV开发——使用JavaCV在窗口显示图像,并监听鼠标点击事件
- 场景中创建N(两个以上)个物体,鼠标可以选中任何物体,当鼠标选中为非地面时,选中的物体变为红色,之前选中的物体恢复为之前的颜色,鼠标点击到地面时,让之前选中的那个物体移动的当前点击的位置
- 【ArcEngine 10 二次开发】DataGridView显示Layer中的属性表
- ArcGIS API for Silverlight之Web Mapping开发:根据图层属性查询、定位、高亮显示
- AE实现右键点击TOC控件任意图层显示属性表
- MapWinGIS+C#二次开发中加载图层无法显示/外部组建发生异常
- 二次开发,向dom中插入容器,完成点击显示大图。
- Visio二次开发——鼠标置于Shape上显示细节信息
- ArcEngine开发——从TocControl上获取鼠标点击位置的信息(转载)
- arcgis二次开发时,c#代码实现鼠标点击地图时,获取地图的表的字段的信息
- ArcGIS API for Silverlight之Web Mapping开发:根据图层属性查询、定位、高亮显示并显示标注(2)
- ArcEngine开发——从TocControl上获取鼠标点击位置的信息
- C#+AE(ArcEngine)二次开发:通过点击选择面状要素并计算其面积
- 显示栅格图层和矢量图层的属性表(AE开发)
- AE实现右键点击TOC控件任意图层显示属性表
- QGis二次开发基础 -- 矢量图层的显示样式