Change sheet tab back color

Posted by: xgsoftware on 8 September 2017, 2:38 pm EST

  • Posted 8 September 2017, 2:38 pm EST

    I want to change the back color of a sheet tab with sheet tab index,I found the way from the help document,the code like this:


    fpSpread1.InterfaceRenderer = null;
    fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off;
    FarPoint.Win.Spread.SheetTab st;
    st = fpSpread1.TabStrip.ActiveSheetTab;
    st.BackColor = Color.Red;


    however if I set the InterfaceRenderer = null , the fpSpread1 will change the skin of the


    sheet tab area, how can i change the sheet tab back color ,at the same time the sheet tab skin


    do not change? thanks for your help

  • Replied 8 September 2017, 2:38 pm EST

    This code will accomplish it.


    FarPoint.Win.Spread.EnhancedInterfaceRenderer eir = new FarPoint.Win.Spread.EnhancedInterfaceRenderer();


    eir.SheetTabLowerActiveColor = Color.Red;


    eir.SheetTabUpperActiveColor = Color.Pink;


    fpSpread1.InterfaceRenderer = eir;


     

  • Replied 8 September 2017, 2:38 pm EST

    thanks paul


    your code can set the active sheet tab color,but what I want like this: there are many sheets in spread


    I want to set the sheet1 tab back color to Red,the sheet2 tab back color to green,the sheet3 tab back color to blue......


    every sheet has it's own sheet tab back color but not only the active sheet tab has back color, How to do this


    thank you

  • Replied 8 September 2017, 2:38 pm EST

    Hello,

    For each sheet tab in the tab strip to have a different color, we can use Spread's Tabstrip's Backcolor property for the same. Here is the code for the same.


            System.Drawing.ColorConverter obj;
            private void Form1_Load(object sender, EventArgs e)
            {
                fpSpread1.Sheets.Count = 4;
                int sheetcount = fpSpread1.Sheets.Count;
                fpSpread1.InterfaceRenderer = null;

                fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off;
                obj = new ColorConverter();
                string[] knowncolors = System.Enum.GetNames(typeof(KnownColor));

                int count1 = knowncolors.Length-1;

                for (int j = 0; j < sheetcount; j++)
                {
                    if (count1 >= 0)
                    {
                        fpSpread1.TabStrip[j].BackColor = (Color)obj.ConvertFromString(knowncolors[count1]);

                        count1 = count1 - 4;
                    }
                }


    Hope this will help you. Thanks.

  • Replied 8 September 2017, 2:38 pm EST

    thanks Reeva Dhingra ,your code can set each sheet tab with diffrent back color ,but with this statment


    fpSpread1.InterfaceRenderer = null;, the fpSpread1 will change the skin of the


    sheet tab area from default to classic, I don't want to change the skin of sheet tab,


    I want to set each sheet tab with diffrent back color,and at the same time the skin of sheet tab do not change


    thanks

  • Replied 8 September 2017, 2:38 pm EST

    Hello,

    It is mandatory to set the interface renderer to
    null before you actually customize the tab strip, it is even mentioned in the
    documentation as well. You can have a look here. And as soon as we set the interface renderer to null the default skin changes which is an expected behaviour.

    Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels