Click here to Skip to main content
15,891,033 members
Articles / Programming Languages / C#

Custom Rendering for the ToolStrip, MenuStrip, and StatusStrip controls

Rate me:
Please Sign up or sign in to vote.
4.50/5 (20 votes)
19 Sep 2008CPOL3 min read 135.1K   6.1K   59  
Custom rendering for the ToolStrip, MenuStrip, and StatusStrip controls.
using System;
using System.Drawing;
using System.Windows.Forms;

namespace System.Windows.Forms
{
    internal class CustomMenuStripColorTable : ProfessionalColorTable
    {
        /// <summary>
        /// Gets the start color of the gradient used in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuStripGradientBegin
        {
            get
            {
                return Properties.Settings.Default.MenuStripGradientBegin;
            }
        }

        /// <summary>
        /// Gets the end color of the gradient used in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuStripGradientEnd
        {
            get
            {
                return Properties.Settings.Default.MenuStripGradientEnd;
            }
        }

        /// <summary>
        /// Gets the start color of the gradient used when the top-level menu item is selected in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemPressedGradientBegin
        {
            get
            {
                return Properties.Settings.Default.MenuItemPressedGradientBegin;
            }
        }

        /// <summary>
        /// Gets the middle color of the gradient used when the top-level menu item is selected in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemPressedGradientMiddle
        {
            get
            {
                return Properties.Settings.Default.MenuItemPressedGradientMiddle;
            }
        }

        /// <summary>
        /// Gets the end color of the gradient used when the top-level menu item is selected in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemPressedGradientEnd
        {
            get
            {
                return Properties.Settings.Default.MenuItemPressedGradientEnd;
            }
        }

        /// <summary>
        /// Gets the start color of the gradient used when the menu item is selected in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemSelectedGradientBegin
        {
            get
            {
                return Properties.Settings.Default.MenuItemSelectedGradientBegin;
            }
        }

        /// <summary>
        /// Gets the end color of the gradient used when the menu item is selected in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemSelectedGradientEnd
        {
            get
            {
                return Properties.Settings.Default.MenuItemSelectedGradientEnd;
            }
        }

        /// <summary>
        /// Gets the color used when the menu item is selected in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemSelected
        {
            get
            {
                return Properties.Settings.Default.MenuItemSelected;
            }
        }

        /// <summary>
        /// Gets the color used for the menu border in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuBorder
        {
            get
            {
                return Properties.Settings.Default.MenuBorder;
            }
        }

        /// <summary>
        /// Gets the color used for the menu item border in the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color MenuItemBorder
        {
            get
            {
                return Properties.Settings.Default.MenuItemBorder;
            }
        }

        /// <summary>
        /// Gets the starting color of the gradient used in the image margin of the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color ImageMarginGradientBegin
        {
            get
            {
                return Properties.Settings.Default.ImageMarginGradientBegin;
            }
        }

        /// <summary>
        /// Gets the middle color of the gradient used in the image margin of the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color ImageMarginGradientMiddle
        {
            get
            {
                return Properties.Settings.Default.ImageMarginGradientMiddle;
            }
        }

        /// <summary>
        /// Gets the ending color of the gradient used in the image margin of the System.Windows.Forms.MenuStrip control.
        /// </summary>
        public override Color ImageMarginGradientEnd
        {
            get
            {
                return Properties.Settings.Default.ImageMarginGradientEnd;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Other
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions