|
楼主 |
发表于 2014-12-22 10:27
|
显示全部楼层
能给我段代码看看吗?我初学者! axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); IQueryFilter pQuery = new QueryFilterClass();
int count = this.dataGridView1.SelectedRows.Count;
string val;
string col;
col = this.dataGridView1.Columns[0].Name;
//当只选中一行时
if (count == 1)
{
val = this.dataGridView1.SelectedRows[0].Cells[col].Value.ToString();
//设置高亮要素的查询条件
pQuery.WhereClause = col + "=" + val;
}
else//当选中多行时
{
int i;
string str;
for (i = 0; i < count - 1; i++)
{
val = this.dataGridView1.SelectedRows.Cells[col].Value.ToString();
str = col + "=" + val + " OR ";
pQuery.WhereClause += str;
}
//添加最后一个要素的条件
val = this.dataGridView1.SelectedRows.Cells[col].Value.ToString();
str = col + "=" + val;
pQuery.WhereClause += str;
}
///////注意下行代码中的SelectedLayer_TOC是当前TOCControl控件中选中的图层,也是要高亮显示要素的图层
SelectedLayer_TOC = pLayer;
IFeatureLayer pFeatureLayer = SelectedLayer_TOC as IFeatureLayer;
IFeatureSelection pFeatSelection;
pFeatSelection = pFeatureLayer as IFeatureSelection;
pFeatSelection.Clear();
pFeatSelection.SelectFeatures(pQuery, esriSelectionResultEnum.esriSelectionResultNew, false);
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
怎么把主窗体中的axMapControl1传到我建立的属性表窗体中的dataview中
|
|