IGraphicsContain 删除元素
分享
刚想实现删除axMapControl 中指定的元素。实现该功能首先得获取欲删除的Element。
下面代码为遍历方式获取其中的Element
IGraphicsContainer pGrappic=axMapControl1.Actiview as IGrapicsContainer
IElement pElement = pGraphic.Next();
IGraphicsContainer 还提供了交互式的获取Elments,其中包括以point的选的 pGraphic.LocateElements和以Envelope 选的pGraphic.LocateElementsByEnvelope。
此为第一种方式。即需人际交互式。
第二种方式为: 在创建Element的时候指定Element的名字,删除的时候删除指定的名称的Element的
IElement pElement = pGraphic.Next();
while (pElement != null)
{
IElementProperties pd = pElement as IElementProperties;
if (pd.Name == name)
{
pGraphic.DeleteElement(pElement);
}
pElement = pGraphic.Next();
}
给Element 指定名字的时候也是得QI到IElementProperties 接口
IElementProperties pEl=pElement as IElementProperties.
pEl.Name="****";
文章来源:http://www.cnblogs.com/myyouthlife/archive/2012/07/15/2592150.html
下面代码为遍历方式获取其中的Element
IGraphicsContainer pGrappic=axMapControl1.Actiview as IGrapicsContainer
IElement pElement = pGraphic.Next();
IGraphicsContainer 还提供了交互式的获取Elments,其中包括以point的选的 pGraphic.LocateElements和以Envelope 选的pGraphic.LocateElementsByEnvelope。
此为第一种方式。即需人际交互式。
第二种方式为: 在创建Element的时候指定Element的名字,删除的时候删除指定的名称的Element的
IElement pElement = pGraphic.Next();
while (pElement != null)
{
IElementProperties pd = pElement as IElementProperties;
if (pd.Name == name)
{
pGraphic.DeleteElement(pElement);
}
pElement = pGraphic.Next();
}
给Element 指定名字的时候也是得QI到IElementProperties 接口
IElementProperties pEl=pElement as IElementProperties.
pEl.Name="****";
文章来源:http://www.cnblogs.com/myyouthlife/archive/2012/07/15/2592150.html
0 个评论
相关问题
- 【【请管理员删除】】
- 如何批量删除空图层?
- 新建.shp类型的FeatureClass,一系列操作后,想要删除源文件。如何解除文件的占用?
- 在Arcpy中获取了一个.shp上的几何元素,如何获取该几何元素的attributes
- arcmap SHP,删除字段中重复的值,只留下一个
- Engine中如何批量删除要素类中符合条件的要素?
- 做网络分析中的路径分析,求解时,出现:网络数据集无边元素错误提示,要怎么修改
- ArcMap中有没有批量删除Polyline中折角的工具?
- ArcGIS如何恢复在结果窗口删除的数据?
- 删除制图表达的按钮成灰色 ,无法删除
- 缓冲区域自相交问题,如何删除相交部分只保留一个?