Exemplo n.º 1
0
        /// <summary>
        /// Applies specified style to Ribbon control and all other controls that are managed by the ribbon control.
        /// This method is useful for example when switching the color tables for Office 2007 renderer. Once
        /// the GlobalManager.Renderer color table is changed you can call this method to apply color table
        /// changes to the Ribbon Control and other controls managed by it.
        /// </summary>
        /// <param name="r">RibbonControl to set the style on.</param>
        /// <param name="style">Visual style to apply.</param>
        public static void SetRibbonControlStyle(RibbonControl r, eDotNetBarStyle style)
        {
            r.BackgroundStyle.Reset();

            if (style == eDotNetBarStyle.Office2010 || style == eDotNetBarStyle.Windows7 || style == eDotNetBarStyle.Metro || style != r.Style)
            {
                ChangeStyle(r, style, r.IsDesignMode, GetColorScheme());
            }
            else
            {
                r.Style = style;

                foreach (Control c in r.Controls)
                {
                    if (c is RibbonPanel)
                    {
                        RibbonPanel rp = c as RibbonPanel;
                        rp.Style.Reset();
                        rp.StyleMouseDown.Reset();
                        rp.StyleMouseOver.Reset();
                        rp.ColorSchemeStyle = style;
                    }
                    else if (c is RibbonBar)
                        SetRibbonBarStyle(c as RibbonBar, style);

                    foreach (Control child in c.Controls)
                    {
                        if (child is RibbonBar)
                            SetRibbonBarStyle(child as RibbonBar, style);
                    }
                }
            }


            r.Invalidate(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Applies Gray color scheme to ribbon control background.
        /// </summary>
        /// <param name="b">Reference to object.</param>
        public static void ApplyGrayColorScheme(RibbonControl b)
        {
            b.BackgroundStyle.Reset();
            TypeDescriptor.GetProperties(b.BackgroundStyle)["BackColor"].SetValue(b.BackgroundStyle, ColorScheme.GetColor("F4F4F4"));
            TypeDescriptor.GetProperties(b.BackgroundStyle)["BackColor2"].SetValue(b.BackgroundStyle, ColorScheme.GetColor("CFCFCF"));
            TypeDescriptor.GetProperties(b.BackgroundStyle)["BackColorGradientAngle"].SetValue(b.BackgroundStyle, 0);
            TypeDescriptor.GetProperties(b.BackgroundStyle)["BackColorGradientType"].SetValue(b.BackgroundStyle, eGradientType.Radial);

            b.Invalidate(true);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Applies Office 2007 color table to ribbon control background.
 /// </summary>
 /// <param name="b">Reference to object.</param>
 public static void ApplyOffice2007ColorScheme(RibbonControl b)
 {
     //Rendering.Office2007ColorTable ct = GetOffice2007ColorTable(b);
     //ApplyRibbonOffice2007ElementStyle(b.BackgroundStyle, ct);
     b.Invalidate(true);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Applies Office 2003 color scheme to ribbon control background.
 /// </summary>
 /// <param name="b">Reference to object.</param>
 public static void ApplyOffice2003ColorScheme(RibbonControl b)
 {
     ApplyRibbonOffice2003ElementStyle(b.BackgroundStyle);
     b.Invalidate(true);
 }