Your refresh method works exactly what you write, refreshes the screen on null Envelope 🙂 joke.You forgot to input refresh area as third parameter, look in SDKhttp://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0012/0012000001nm000000.htmIn desktop SDK there is also a sample, if you didn't install desktop developer help there is code, only was available in VB6, sorry. But conversion is pretty straight forward.
[Visual Basic 6.0]
Public Sub SelectDataFrameGraphicsAndRefresh()
' selects data frame graphics in ArcMap, regardless of whether you are in data view or layout view
Dim pMxDocument As IMxDocument
Set pMxDocument = Application.Document
Dim pMapView As IActiveView
Set pMapView = pMxDocument.FocusMap
If TypeOf pMxDocument.ActiveView Is IPageLayout Then
pMxDocument.ActiveView.IsMapActivated = True '<=== To show the activated border in layout view. Doesn't work in data view.
pMapView.ShowSelection = True '<=== In layout view data graphic selection is not normally shown
End If
' Select graphics
Dim pMapGraphicsSelect As IGraphicsContainerSelect
Set pMapGraphicsSelect = pMxDocument.FocusMap '<==== Map implements IGraphicsContainerSelect.
pMapGraphicsSelect.SelectAllElements
' Refresh
pMapView.PartialRefresh esriViewGraphicSelection, Nothing, Nothing '<=== Refresh only the selectionEnd Sub Public Sub SelectMapFeaturesAndRefresh()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pActiveView As IActiveView
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pQueryFilter As IQueryFilter
Set pMxDoc = Application.Document
Set pMap = pMxDoc.FocusMap
Set pActiveView = pMap
'For simplicity sake let's use the first layer in the map
If Not TypeOf pMap.Layer(0) Is IFeatureLayer Then Exit Sub
Set pFeatureLayer = pMap.Layer(0)
Set pFeatureSelection = pFeatureLayer 'QI
'Create the query filter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = "NAME = 'Nova Scotia'"
'Invalidate only the selection cache
'Flag the original selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
'Perform the selection
pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False
'Flag the new selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
End Sub