Select to view content in your preferred language

ArcScene Background Color - Harder than it should be.

779
2
02-10-2011 01:10 PM
WilliamMcInnes
Deactivated User
I'm having trouble setting the background color in ArcScene

I can "set" the backroundcolor i.e. the message box reports it as being changed, but it doesn't change in the scene.

The refreshviewers method refreshes the background to white, even though the default background is something different (150,0,150)

In the GUI, this code does set the combobox background color to grey (128,128,128)
but it doesn't apply.

Code attached below.

How do I get the background to change?

Public Sub ChangeBackground()

    Dim pSxDoc As ISxDocument
    Set pSxDoc = ThisDocument

    Dim pViews3d As IViewers3D
    Set pViews3d = pSxDoc.Scene.SceneGraph
    
    Dim r As Single
    Dim g As Single
    Dim b As Single
    
    pViews3d.SetBackgroundColor 128, 128, 128
    pViews3d.GetBackgroundColor r, g, b
      
    MsgBox r & g & b
    
    pViews3d.RefreshViewers

End Sub


End Sub

Cheers,

Will
0 Kudos
2 Replies
Venkata_RaoTammineni
Regular Contributor
I'm having trouble setting the background color in ArcScene

I can "set" the backroundcolor i.e. the message box reports it as being changed, but it doesn't change in the scene.

The refreshviewers method refreshes the background to white, even though the default background is something different (150,0,150)

In the GUI, this code does set the combobox background color to grey (128,128,128)
but it doesn't apply.

Code attached below.

How do I get the background to change?

Public Sub ChangeBackground()

    Dim pSxDoc As ISxDocument
    Set pSxDoc = ThisDocument

    Dim pViews3d As IViewers3D
    Set pViews3d = pSxDoc.Scene.SceneGraph
    
    Dim r As Single
    Dim g As Single
    Dim b As Single
    
    pViews3d.SetBackgroundColor 128, 128, 128
    pViews3d.GetBackgroundColor r, g, b
      
    MsgBox r & g & b
    
    pViews3d.RefreshViewers

End Sub


End Sub

Cheers,

Will


Mostly you play with Scene ..if you want to change and once you run the code...  go scene properties and press Restore Default colors

Public Sub test()
    Dim pSxDoc As ISxDocument
    Set pSxDoc = ThisDocument

    Dim pViews3d As IViewers3D
    Set pViews3d = pSxDoc.Scene.SceneGraph
   
    Dim r As Single
    Dim g As Single
    Dim b As Single
   
    pViews3d.Scene.SetDefaultBackgroundColor 128, 128, 128
        
      
    pViews3d.RefreshViewers
     
    pViews3d.GetAllViewers
  
End Sub
0 Kudos
WilliamMcInnes
Deactivated User
I added pViews3d.GetAllViewers, and it reports changing the color, but it still refreshes to white.

Thanks though.
0 Kudos