I want to set the background mode of all windows to Gradient2Color. I searched the forum resources and found no information. Please help me.
As far as I know, background styles are not related to viewports but they are related to displayModes.
But in your case, you can change the background style in displayMode of all your viewports.
import Rhino
for view in Rhino.RhinoDoc.ActiveDoc.Views:
displayMode = view.ActiveViewport.DisplayMode
displayMode.DisplayAttributes.FillMode = Rhino.Display.DisplayPipelineAttributes.FrameBufferFillMode.Gradient2Color
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(displayMode)
@Mahdiyar Thank you.
But how to set the GradTopLeft color and GradBotLeft color of the Gradient2Color?
You can use DisplayPipelineAttributes.SetFill method:
import Rhino
import System
for view in Rhino.RhinoDoc.ActiveDoc.Views:
displayMode = view.ActiveViewport.DisplayMode
displayMode.DisplayAttributes.FillMode = Rhino.Display.DisplayPipelineAttributes.FrameBufferFillMode.Gradient2Color
displayMode.DisplayAttributes.SetFill(System.Drawing.Color.Black, System.Drawing.Color.White)
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(displayMode)
Thanks for your help.