IGraphicsContainer.BringForward example

835
1
03-06-2012 08:26 AM
SpencerGardner
New Contributor II
Can anyone point me to an example that uses the BringForward method of IGraphicsContainer? I've searched high and low and haven't seen anything. I've tried looping through all elements, selecting the mapframe that I want with IGraphicsContainerSelect and then submitting SelectedElements in the BringForward call but that doesn't seem to do anything.
0 Kudos
1 Reply
TimWhiteaker
Occasional Contributor II
I don't know of an online sample, but this code worked for me in ArcGIS 9.2 VBA.  It just sends forward the first map it finds in the layout.

  Dim d As IMxDocument
  Set d = ThisDocument
  
  Dim gc As IGraphicsContainer
  Dim gcs As IGraphicsContainerSelect
  Set gc = d.PageLayout
  Set gcs = gc
  
  gcs.UnselectAllElements
  
  gc.Reset
  Dim e As IElement
  Set e = gc.Next
  
  Do Until e Is Nothing
    If TypeOf e Is IMapFrame Then
      gcs.SelectElement e
      gc.BringForward g.SelectedElements
      Exit Do
    End If
  
    Set e = gc.Next
  Loop
  
  d.ActiveView.Refresh
0 Kudos