示例#1
0
 protected override void Initialize(ToolStrip toolStrip)
 {
     if (toolStrip is MenuStrip)
     {
         if (toolStrip.BackgroundImage != null)
             MenuStripStyle = ToolStripType.Image;
         toolStrip.BackgroundImageChanged += new EventHandler(toolStrip_BackgroundImageChanged);
     }
     else if (toolStrip is StatusStrip)
     {
         if (toolStrip.BackgroundImage != null)
             StatusStripStyle = ToolStripType.Image;
         toolStrip.BackgroundImageChanged += new EventHandler(toolStrip_BackgroundImageChanged);
     }
     else
     {
         if (toolStrip.BackgroundImage != null)
             ToolStripStyle = ToolStripType.Image;
         toolStrip.BackgroundImageChanged += new EventHandler(toolStrip_BackgroundImageChanged);
     }
     base.Initialize(toolStrip);
 }
示例#2
0
 /// <summary>
 /// Sets ToolStrip style elements. 
 /// </summary>
 /// <param name="style">The ToolStrip control to be stylized.</param>
 /// <param name="begin">The gradient start color, or flat color used to paint the control.</param>
 /// <param name="end">The gradient end color.</param>
 /// <param name="blend">The gradient blend used to control the gradient aspect.</param>
 public void SetToolStripStyle(ToolStripType style, Color begin, Color end, Blend blend)
 {
     ToolStripStyle = style;
     if (ToolStripStyle == ToolStripType.HorizontalGradient)
     {
         ToolStripGradientDirection = LinearGradientMode.Horizontal;
         ToolStripGradientBegin = begin;
         ToolStripGradientEnd = end;
         if (blend != null)
             ToolStripGradientBlend = blend;
     }
     else if (ToolStripStyle == ToolStripType.VerticalGradient)
     {
         ToolStripGradientDirection = LinearGradientMode.Vertical;
         ToolStripGradientBegin = begin;
         ToolStripGradientEnd = end;
         if (blend != null)
             ToolStripGradientBlend = blend;
     }
     else
     {
         ToolStripGradientBegin = begin;
         ToolStripGradientEnd = end;
     }
 }
示例#3
0
 /// <summary>
 /// Sets styles for all added ToolStrip controls. 
 /// </summary>
 /// <param name="toolstyle">The ToolStrip control to be stylized.</param>
 /// <param name="menustyle">The Menu display style.</param>
 /// <param name="buttonstyle">The button hover effect style.</param>
 /// <param name="begin">The gradient start color, or flat color used to paint the control.</param>
 /// <param name="end">The gradient end color.</param>
 /// <param name="blend">The gradient blend used to control the gradient aspect. Pass null for default blend.</param>
 public void SetGlobalStyles(ToolStripType toolstyle, MenuType menuStyle, ButtonHoverType buttonStyle, Color begin, Color end, Blend blend)
 {
     SetToolStripStyle(toolstyle, begin, end, blend);
     SetMenuStripStyle(toolstyle, menuStyle, begin, end, blend);
     SetButtonHoverStyle(buttonStyle);
     SetStatusStripStyle(toolstyle, begin, end, blend);
 }
示例#4
0
        /// <summary>
        /// Sets MenuStrip style elements. 
        /// </summary>
        /// <param name="stripStyle">The MenuStrip control to be stylized.</param>
        /// <param name="menuStyle">The Menu display style.</param>
        /// <param name="begin">The gradient start color, or flat color used to paint the control.</param>
        /// <param name="end">The gradient end color.</param>
        /// <param name="blend">The gradient blend used to control the gradient aspect. Pass null for default blend.</param>
        public void SetMenuStripStyle(ToolStripType stripStyle, MenuType menuStyle, Color begin, Color end, Blend blend)
        {
            MenuStripStyle = stripStyle;
            if (MenuStripStyle == ToolStripType.HorizontalGradient)
            {
                MenuStripGradientDirection = LinearGradientMode.Horizontal;
                MenuStripGradientBegin = begin;
                MenuStripGradientEnd = end;
                if (blend != null)
                    MenuStripGradientBlend = blend;
            }
            else if (MenuStripStyle == ToolStripType.VerticalGradient)
            {
                MenuStripGradientDirection = LinearGradientMode.Vertical;
                MenuStripGradientBegin = begin;
                MenuStripGradientEnd = end;
                if (blend != null)
                    MenuStripGradientBlend = blend;
            }
            else
            {
                MenuStripGradientBegin = begin;
                MenuStripGradientEnd = end;
            }

            MenuStyle = menuStyle;
            if ((MenuStyle == MenuType.Custom) || (MenuStyle == MenuType.Flat))
            {
                MenuSelectorBarEdge = Color.FromArgb(250, Color.DarkGray);
                MenuSelectorBarGradientBegin = Color.FromArgb(140, Color.White);
                MenuSelectorBarGradientEnd = Color.FromArgb(120, 0xb3, 0xb3, 0xb3);
                ButtonGradientBegin = Color.White;
            }
            else if (MenuStyle == MenuType.Office)
            {
                MenuSelectorBarEdge = Color.FromArgb(250, 0xa9, 0xc8, 0xf5);
                MenuSelectorBarGradientBegin = Color.FromArgb(140, 0xe1, 0xf5, 0xfb);
                MenuSelectorBarGradientEnd = Color.FromArgb(120, 0xa5, 0xc4, 0xf1);
                ButtonBorderColor = Color.LightGray;
                ButtonGradientBegin = Color.FromArgb(200, 0x33, 0x99, 0xff);
                ButtonGradientEnd = Color.FromArgb(150, 0xc0, 0xdd, 0xfc);

            }
            else if (MenuStyle == MenuType.Vista)
            {
                MenuSelectorBarEdge = Color.FromArgb(150, 0xA9, 0xC8, 0xF5);
                MenuSelectorBarGradientBegin = Color.FromArgb(140, Color.White);
                MenuSelectorBarGradientEnd = Color.FromArgb(200, Color.PowderBlue);
                MenuBackGroundColor = Color.FromArgb(255, 0xf5, 0xf5, 0xf5);
                MenuImageMarginGradientBegin = Color.FromArgb(255, 0xec, 0xec, 0xec);
                ButtonGradientBegin = Color.DodgerBlue;
            }
        }
示例#5
0
 private void toolStrip_BackgroundImageChanged(object sender, EventArgs e)
 {
     ToolStrip toolStrip = (ToolStrip)sender;
     try
     {
         if (toolStrip.BackgroundImage != null)
         {
             if (toolStrip is MenuStrip)
                 MenuStripStyle = ToolStripType.Image;
             else if (toolStrip is StatusStrip)
                 StatusStripStyle = ToolStripType.Image;
             else
                 ToolStripStyle = ToolStripType.Image;
         }
     }
     finally { }
 }