Good weekend,
I am trying to change map from another form. Say AxMap1 is on Form1, I want to change the color of map or select by attributes by open another form (form2), build my query and pass it to Query, all fine.
Then access Form1 from form2:
Form1 fm = new Form1();
object selected returns the correct number, but fm.axMap1.ZoomToSelected(layerHandle); doesn’t work?
Same thing to change color: (color code selection is on another form). I can see it is working but doesn’t show on map.
So my question is: how do you work with map controls from another form?
if (sf.Table.Query(query, ref result, ref error))
{
int[] shapes = result as int[];
if (shapes != null)
{
for (int i = 0; i < shapes.Length; i++)
{
sf.set_ShapeSelected(shapes[i], true);
}
}
fm.axMap1.ZoomToSelected(layerHandle);
fm.axMap1.Refresh();
// fm.axMap1.Redraw();
MessageBox.Show("Objects selected: " + sf.NumSelected);
}
else
{
MessageBox.Show("No shapes agree with the condition.");
}