how to change color of comboBoxEx Dotnetbar as form has StyleManager with different style

1.9k views Asked by At

My mdiMain StyleManager properties are below ManagerStyle :Office2013 MetroColorParameters:CanvasColor:black, baseColor:White and my child form i wanted to give different back color and border color to Combo Box as with StyleManager it is black color, which i wanted it to change to white background gray borders.

i am using the below code to change the color after my StyleManager had changed the Style

         LinearGradientColorTable linGrBrush = new LinearGradientColorTable(
         Color.FromArgb(192, 192, 192),  
         Color.FromArgb(104, 104, 104));  

            if (GlobalManager.Renderer is Office2007Renderer)
            {
              Office2007ColorTable ct = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;

              ct.ComboBox.DroppedDown.Background = Color.White;
              ct.ComboBox.Default.Background = Color.White;
              ct.ComboBox.Default.ExpandBackground = linGrBrush;
              ct.ComboBox.DroppedDown.Border = Color.Gray;
              ct.ComboBox.Default.Border = Color.Gray; 
             }
1

There are 1 answers

0
prasy On BEST ANSWER

below is code which solved my problem i used ComboBox.DefaultStandalone property instead of ComboBox.Default

       LinearGradientColorTable linGrBrush = new LinearGradientColorTable(
           Color.DarkGray,
           Color.DarkGray);

        Office2007Renderer renderer = GlobalManager.Renderer as Office2007Renderer;
        if (renderer == null) return;
        Office2007ColorTable table = renderer.ColorTable;
        // Stand-alone ComboBoxEx colors
        Office2007ComboBoxColorTable comboColors = table.ComboBox;
        comboColors.DefaultStandalone.Border = Color.DarkGray;
        comboColors.DefaultStandalone.Background = Color.White;
        comboColors.DefaultStandalone.ExpandText = Color.LightGray;
        comboColors.DefaultStandalone.ExpandBorderInner = linGrBrush;
        comboColors.DefaultStandalone.ExpandBorderOuter = linGrBrush;