/// <summary> /// Get the brush color associated with the desired GuiColor and match our /// dialog style colors to it. /// </summary> /// <param name="colorManager"></param> /// <param name="guiColor"></param> /// <returns></returns> private static Brush GetUiColorBrush(IIColorManager colorManager, GuiColors guiColor) { var color = colorManager.GetColor(guiColor); var mcolorText = MediaColor.FromRgb(color.R, color.G, color.B); return(new SolidColorBrush(mcolorText)); }
public ExplodeGeomUserControl1(System.Windows.Window creator) { m_winParent = creator; InitializeComponent(); IGlobal global = Autodesk.Max.GlobalInterface.Instance; IInterface14 ip = global.COREInterface14; IIColorManager cm = global.ColorManager; System.Drawing.Color dcolBack = cm.GetColor(Autodesk.Max.GuiColors.Background, Autodesk.Max.IColorManager.State.Normal); // due to a bug in the 3ds Max .NET API before 2017, you would have to reverse the R and B values to assign color properly. // The Autodesk.Max assembly mapped them incorrectly // pre 2017: System.Windows.Media.Color mcolorBack = System.Windows.Media.Color.FromRgb(dcolBack.B, dcolBack.G, dcolBack.R); // Get current background color and match our dialog to it System.Windows.Media.Color mcolorBack = System.Windows.Media.Color.FromRgb(dcolBack.R, dcolBack.G, dcolBack.B); Brush colorBack = new SolidColorBrush(mcolorBack); // Note, if you want just a fixed color, you can comment this out and use the XAML defined value. LayoutRoot.Background = colorBack; // Get current text color and match our dialog to it. System.Drawing.Color dcolText = cm.GetColor(Autodesk.Max.GuiColors.Text, Autodesk.Max.IColorManager.State.Normal); // pre 2017: System.Windows.Media.Color mcolorText = System.Windows.Media.Color.FromRgb(dcolText.B, dcolText.G, dcolText.R); System.Windows.Media.Color mcolorText = System.Windows.Media.Color.FromRgb(dcolText.R, dcolText.G, dcolText.B); Brush colorText = new SolidColorBrush(mcolorText); // To use pure white, we can just set a system brush. //Brush colorText = Brushes.White; m_gbExplodeTypes.Foreground = colorText; m_rbTriangles.Foreground = colorText; m_rbPolygons.Foreground = colorText; m_gbExplodeOptions.Foreground = colorText; m_cbConvertTri.Foreground = colorText; m_cbConvertPoly.Foreground = colorText; m_cbAddShell.Foreground = colorText; m_lblNumOffset.Foreground = colorText; m_cbAddEditMesh.Foreground = colorText; m_cbCollapseStack.Foreground = colorText; m_cbCenterPivot.Foreground = colorText; m_cbDeleteOriginal.Foreground = colorText; // This is a button control, and we are not setting its color. // So we will not change the text color either. //m_btnExplodeIt.Foreground = colorText; m_lblLabelProNode.Foreground = colorText; m_lblNodeName.Foreground = colorText; m_lblLabelNode.Foreground = colorText; m_lblCurrNode.Foreground = colorText; m_lblLabelOf.Foreground = colorText; m_lblTotNode.Foreground = colorText; m_lblLabelEscape.Foreground = colorText; }