Sample Code: Setting the Background Window Color

Version

HPS 2020

Language

C++

Description:

To change the background color and the background type of the window, two controls are required:

To set the color of the window, a material mapping control is called:

view.GetSegmentKey().GetMaterialMappingControl().SetWindowColor(RGBAColor(0.5, 0.5, 0.5));

Building on the previous code snippet, we can also add a second color if the subwindow has a gradient background:

view.GetSegmentKey().GetMaterialMappingControl().SetWindowColor(RGBAColor(0.5, 0.5, 0.5)).SetWindowContrastColor(RGBAColor(1.0, 0.0, 0.0));

To set the background type (solid color, gradient, etc.), a subwindow control is called:

view.GetSegmentKey().GetSubwindowControl().SetBackground(Subwindow::Background::GradientBottomToTop);

Additional information on the Subwindow::Background enumerations can be found via the link below:

https://docs.techsoft3d.com/hps/latest/api_ref/cs/class_h_p_s_1_1_subwindow_control.html#function-HPS.SubwindowControl.SetBackground