调用查看属性的功能之后,一直关闭不了,怎么取消呢?
SDNJD 2012-03-23 11:40:06 这是我再Form1里面的代码,就是调用查看属性的这个窗口:
//调用属性信息窗口
private void PropertyViaFeature_Click(object sender, EventArgs e)
{
toolSelected = true;
}
下面是弹出的属性窗口的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
namespace ArcEngine
{
public partial class frmProperty : Form
{
public IMapControl2 pMapControl;
public IEnvelope pEnvelop;
public frmProperty(IMapControl2 pFMapControl, IEnvelope pFEnvelop)
{
InitializeComponent();
pMapControl = pFMapControl;
pEnvelop = pFEnvelop;
}
//显示树状属性窗口
public void SelectPropertyViaFeature()
{
treeView1.Nodes.Clear();
for (int i = 0; i < pMapControl.Map.LayerCount; i++)
{
IFeatureLayer pFeatureLayer = (IFeatureLayer)pMapControl.Map.get_Layer(i);
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
ISpatialFilter pSpatialFilter = new SpatialFilterClass();
pSpatialFilter.Geometry = pEnvelop;
pSpatialFilter.GeometryField = pFeatureClass.ShapeFieldName;
pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
IFields pFields = pFeatureClass.Fields;
IFeatureCursor pFeatureCursor = pFeatureClass.Search(pSpatialFilter, false);
TreeNode nodeParent;
IFeature pFeature;
pFeature = pFeatureCursor.NextFeature();
if (pFeature != null)
{
nodeParent = treeView1.Nodes.Add(pFeatureLayer.Name.ToString());
while (pFeature != null)
{
TreeNode nodeSon;
for (int j = 0; j < pFields.FieldCount; j++)
{
string fldValue;
string fldName;
fldName = pFields.get_Field(j).Name;
if (fldName == "Shape")
{
fldValue = Convert.ToString(pFeature.Shape.GeometryType);
}
else
fldValue = Convert.ToString(pFeature.get_Value(j));
nodeSon = nodeParent.Nodes.Add(fldValue);
}
pMapControl.Map.SelectFeature(pFeatureLayer, pFeature);
pFeature = pFeatureCursor.NextFeature();
}
}
}
IActiveView pActiveView;
pActiveView = (IActiveView)pMapControl.Map;
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
private void frmProperty_Load(object sender, EventArgs e)
{
SelectPropertyViaFeature();
}
}
}
我现在遇到的问题是用这个功能之后,再用其他的功能,但这个功能一直都取消不了,就是一直到弹出属性窗口,我的意思是想用完这个功能之后,怎么关掉查看属性的这个功能呢?谢谢各位了!