Exemple #1
0
        /// <summary>
        ///     Sets the appropriate colors to the given <see cref="TabPage"/>.
        /// </summary>
        private void RefreshTabPageColors(TabPage tabPage)
        {
            //We don't touch to the tab pages in design mode to prevent
            //the designer from setting the property value in the designer
            //generated file. As a side effect of this check, the designer
            //preview is not faithful to the actual result.
            if (DesignMode)
            {
                return;
            }

            if (FlatStyle == FlatStyle.Flat)
            {
                tabPage.UseVisualStyleBackColor = false;
                tabPage.BackColor = FlatTabSelectedBackColor;
                tabPage.ForeColor = FlatTabSelectedForeColor;
            }
            else
            {
                tabPage.ResetBackColor();
                tabPage.ResetForeColor();
                tabPage.UseVisualStyleBackColor = true;
            }
        }