How to unselect feature after open the map document?

973
4
10-22-2013 04:56 PM
kju
by
New Contributor III
I do not know way,when open the map document,I found that one of the feature is holding the 'selected' status.I try everything I can to unselect the feature which result in flickering the all of the form.So what can I do now?Thanks very much.
Here is what I did.
Add the code:
map_con_main.Map.ClearSelection();
            map_con_main.ActiveView.Refresh();

to the method "FormMain_Shown"an "OnAfterScreenDraw"and so no.
0 Kudos
4 Replies
HailiangShen
New Contributor
Try map_con_main.ActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing. This should only refresh your selection features.
0 Kudos
NeilClemmons
Regular Contributor III
I do not know way,when open the map document,I found that one of the feature is holding the 'selected' status.I try everything I can to unselect the feature which result in flickering the all of the form.So what can I do now?Thanks very much.
Here is what I did.
Add the code:
map_con_main.Map.ClearSelection();
            map_con_main.ActiveView.Refresh();

to the method "FormMain_Shown"an "OnAfterScreenDraw"and so no.


If calling ClearSelection and Refresh doesn't clear the selection then a) the feature isn't actually selected (maybe it's a graphic element or something that makes it appear to be selected?) or b) map_con_main.Map isn't referencing the map you think it's referencing.  Is this running in ArcMap?  If yes, then what happens if you click the ArcMap Clear Feature Selection button on the toolbar?
0 Kudos
kju
by
New Contributor III
If calling ClearSelection and Refresh doesn't clear the selection then a) the feature isn't actually selected (maybe it's a graphic element or something that makes it appear to be selected?) or b) map_con_main.Map isn't referencing the map you think it's referencing.  Is this running in ArcMap?  If yes, then what happens if you click the ArcMap Clear Feature Selection button on the toolbar?

Everything you said is right, opening in arcmap instead of running in my app. did make the same situation before,and it appear selected but not,unselect on Button event will remove the virtual selection. I do not know why,sometimes I just do not want to be aware of this, open another mxd does not the happen like this.When I add a polygon feature to the mxd,it disappear(turn normal). I thought that may be a bug.
0 Kudos
kju
by
New Contributor III
Try map_con_main.ActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing. This should only refresh your selection features.

Thanks for your response.My mxd do not happen the virtual selection again after I add a polygon feature to my mxd document. I thougt your ideal may not make it. I think that may be a bug.
0 Kudos