DataGridView与layer属性表的关联问题

private void dataGridViewX2_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            IMap pmap = axMapControl1.Map;
            string FID;
            FID = dataGridViewX2.Rows[e.RowIndex].Cells[0].Value.ToString();

            if (FID == "")
                return;
            IActiveView pActiveView;
            pActiveView = (IActiveView)pmap;
            pmap.ClearSelection();
            pActiveView.Refresh();

            IQueryFilter pQueryFilter = new QueryFilterClass();
            pQueryFilter.WhereClause = "OBJECTID=" + FID;
            
            IFeatureLayer pFeatureLayer;
            pFeatureLayer = (IFeatureLayer)pmap.get_Layer(0);

            IFeatureCursor pFeatureCursor;
            pFeatureCursor = pFeatureLayer.Search(pQueryFilter, false);

            IFeature pFeature;
            pFeature = pFeatureCursor.NextFeature();

            pmap.SelectFeature(pFeatureLayer, pFeature);

            IPoint pPoint = new PointClass();
            pPoint.X = (pFeature.Extent.XMin + pFeature.Extent.XMax) / 2;
            pPoint.Y = (pFeature.Extent.YMin + pFeature.Extent.YMax) / 2;

            axMapControl1.CenterAt(pPoint);

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);

        }

你可能感兴趣的:(DataGridView与layer属性表的关联问题)