By using the QueryFilter I am getting some features based on the query and I am placing that feature names in a listbox.
When the user selects a particular name in the listbox that feature has to be zoomed to in the map.
Below is my code:
IQueryFilter pQueryFilter = new QueryFilterClass();
pQueryFilter.WhereClause = textBox1.Text + textBox2.Text;
ICursor pCursor = pFeatureClass.Search(pQueryFilter, true) as ICursor;
IRow pRow = pCursor.NextRow();
while (pRow != null)
{
listBox2.Items.Add(pRow.get_Value(9).ToString());
pRow = pCursor.NextRow();
}
Here is what I tried:
IActiveView pActiveView = pMxDocument.ActiveView;
IGeometry pGeometry = pFeature.Shape;
IEnvelope pEnvelope = pGeometry.Envelope;
pActiveView.Extent = pEnvelope.Expand(1.2, 1.2, true);
But I am unable to zoom.
Best Answer
This is not tested.