Changeset - 65c134a3d619
[Not reviewed]
default
! ! !
mkanning@CL-ENS241-10.cedarville.edu - 13 years ago 2013-02-07 15:46:57
mkanning@CL-ENS241-10.cedarville.edu
Initial import of mapping source (huge commit)
31 files changed:
Changeset was too big and was cut off... Show full diff anyway
0 comments (0 inline, 0 general)
Demo.WindowsForms/BSE.Windows.Forms/ProgressBar/ProgressBar.Designer.cs
Show inline comments
 
new file 100644
 
namespace BSE.Windows.Forms
 
{
 
    partial class ProgressBar
 
    {
 
        /// <summary>
 
        /// Required designer variable.
 
        /// </summary>
 
        private System.ComponentModel.IContainer components = null;
 
 
        /// <summary> 
 
        /// Clean up any resources being used.
 
        /// </summary>
 
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 
        protected override void Dispose(bool disposing)
 
        {
 
            if (disposing && (components != null))
 
            {
 
                components.Dispose();
 
            }
 
            base.Dispose(disposing);
 
        }
 
 
        #region Component Designer generated code
 
 
        /// <summary>
 
        /// Required method for Designer support - do not modify
 
        /// the contents of this method with the code editor.
 
        /// </summary>
 
        private void InitializeComponent()
 
        {
 
            components = new System.ComponentModel.Container();
 
            this.Size = new System.Drawing.Size(100, 23);
 
            this.Name = "progressBar";
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/ProgressBar/ProgressBar.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.ComponentModel;
 
using System.Diagnostics;
 
using System.Text;
 
using System.Windows.Forms;
 
using System.Drawing;
 
using System.Globalization;
 
using Demo.WindowsForms.Properties;
 
using System.Drawing.Drawing2D;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Represents a Windows progress bar control. 
 
    /// </summary>
 
    /// <copyright>Copyright © 2008 Uwe Eichkorn
 
    /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
    /// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
    /// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
    /// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
    /// REMAINS UNCHANGED.
 
    /// </copyright>
 
    [ToolboxBitmap(typeof(System.Windows.Forms.ProgressBar))]
 
    public partial class ProgressBar : Control
 
    {
 
        #region Events
 
        /// <summary>
 
        /// Occurs when the value of the BorderColor property changes.
 
        /// </summary>
 
        [Description("Occurs when the value of the BorderColor property is changed on the control.")]
 
        public event EventHandler<EventArgs> BorderColorChanged;
 
        /// <summary>
 
        /// Occurs when the value of the BackgroundColor property changes.
 
        /// </summary>
 
        [Description("Occurs when the value of the BackgroundColor property is changed on the control.")]
 
        public event EventHandler<EventArgs> BackgroundColorChanged;
 
        /// <summary>
 
        /// Occurs when the value of the ValueColor property changes.
 
        /// </summary>
 
        [Description("Occurs when the value of the ValueColor property is changed on the control.")]
 
        public event EventHandler<EventArgs> ValueColorChanged;
 
        #endregion
 
 
        #region FieldsPrivate
 
        private Color m_backgroundColor;
 
        private Color m_valueColor;
 
        private Color m_borderColor;
 
        private int m_iMinimum;
 
        private int m_iMaximum;
 
        private int m_iValue;
 
        #endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets or sets the color used for the background rectangle of this control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Color"/>
 
        /// A Color used for the background rectangle of this control.
 
        /// </value>
 
        [Browsable(true)]
 
        [Description("The color used for the background rectangle of this control.")]
 
        public Color BackgroundColor
 
        {
 
            get { return this.m_backgroundColor; }
 
            set
 
            {
 
                if (this.m_backgroundColor != value)
 
                {
 
                    this.m_backgroundColor = value;
 
                    OnBackgroundColorChanged(this, EventArgs.Empty);
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Gets or sets the color used for the value rectangle of this control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Color"/>
 
        /// A Color used for the value rectangle of this control.
 
        /// </value>
 
        [Browsable(true)]
 
        [Description("The color used for the value rectangle of this control.")]
 
        public Color ValueColor
 
        {
 
            get { return this.m_valueColor; }
 
            set
 
            {
 
                if (this.m_valueColor != value)
 
                {
 
                    this.m_valueColor = value;
 
                    OnValueColorChanged(this, EventArgs.Empty);
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Gets or sets the border color for the control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Color "/>
 
        /// A Color that represents the border color of the control.
 
        /// </value>
 
        public Color BorderColor
 
        {
 
            get { return this.m_borderColor; }
 
            set
 
            {
 
                if (this.m_borderColor != value)
 
                {
 
                    this.m_borderColor = value;
 
                    OnBorderColorChanged(this, EventArgs.Empty);
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Gets or sets the background color for the control.
 
        /// </summary>
 
        [Browsable(false)]
 
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
 
        public new Color BackColor
 
        {
 
            get { return base.BackColor; }
 
            set { base.BackColor = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the maximum value of the range of the control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Int32"/>
 
        /// The maximum value of the range. The default is 100.
 
        /// </value>
 
        [Browsable(true)]
 
        [Description("The upper bound of range this ProgressBar is working with.")]
 
        public int Maximum
 
        {
 
            get { return this.m_iMaximum; }
 
            set
 
            {
 
                if (this.m_iMaximum != value)
 
                {
 
                    if (value < 0)
 
                    {
 
                        object[] args = new object[] { "Maximum", value.ToString(CultureInfo.CurrentCulture), "Maximum" };
 
                        throw new ArgumentOutOfRangeException("Maximum", string.Format(CultureInfo.InvariantCulture, Resources.IDS_InvalidLowBoundArgument, args));
 
                    }
 
                    if (this.m_iMinimum > value)
 
                    {
 
                        this.m_iMinimum = value;
 
                    }
 
                    this.m_iMaximum = value;
 
                    if (this.m_iValue > this.m_iMaximum)
 
                    {
 
                        this.m_iValue = this.m_iMaximum;
 
                    }
 
                    UpdatePos();
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Gets or sets the minimum value of the range of the control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Int32"/>
 
        /// The minimum value of the range. The default is 0.
 
        /// </value>
 
        [Browsable(true)]
 
        [Description("The lower bound of range this ProgressBar is working with.")]
 
        public int Minimum
 
        {
 
            get { return this.m_iMinimum; }
 
            set
 
            {
 
                if (this.m_iMinimum != value)
 
                {
 
                    if (value < 0)
 
                    {
 
                        object[] args = new object[] { "Minimum", value.ToString(CultureInfo.CurrentCulture), "Minimum" };
 
                        throw new ArgumentOutOfRangeException("Minimum", string.Format(CultureInfo.InvariantCulture, Resources.IDS_InvalidLowBoundArgument, args));
 
                    }
 
                    if (this.m_iMaximum < value)
 
                    {
 
                        this.m_iMaximum = value;
 
                    }
 
                    this.m_iMinimum = value;
 
                    if (this.m_iValue < this.m_iMinimum)
 
                    {
 
                        this.m_iValue = this.m_iMinimum;
 
                    }
 
                    UpdatePos();
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Gets or sets the current position of the progress bar.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Int32"/>
 
        /// The position within the range of the progress bar. The default is 0.
 
        /// </value>
 
        [Browsable(true)]
 
        [Description("The current value for the ProgressBar, in the range specified by the minimum and maximum properties.")]
 
        public int Value
 
        {
 
            get { return this.m_iValue; }
 
            set
 
            {
 
                if (this.m_iValue != value)
 
                {
 
                    if ((value < this.m_iMinimum) || (value > this.m_iMaximum))
 
                    {
 
                        throw new ArgumentOutOfRangeException("Value", string.Format(CultureInfo.InvariantCulture, Resources.IDS_InvalidBoundArgument, new object[] { "Value", value.ToString(CultureInfo.CurrentCulture), "'minimum'", "'maximum'" }));
 
                    }
 
                    this.m_iValue = value;
 
                    UpdatePos();
 
                }
 
            }
 
        }
 
        #endregion
 
 
        #region MethodsPublic
 
        /// <summary>
 
        /// Initializes a new instance of the ProgressBar class.
 
        /// </summary>
 
        public ProgressBar()
 
        {
 
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
 
            this.SetStyle(ControlStyles.UserPaint, true);
 
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
 
            this.SetStyle(ControlStyles.ResizeRedraw, true);
 
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
 
            InitializeComponent();
 
 
            this.m_iMaximum = 100;
 
            this.m_backgroundColor = Color.FromArgb(20, 20, 255);
 
            this.m_valueColor = Color.FromArgb(255, 0, 255);
 
            this.m_borderColor = SystemColors.ActiveBorder;
 
            this.BackColor = Color.Transparent;
 
        }
 
        #endregion
 
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Raises the Paint event.
 
        /// </summary>
 
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
 
        protected override void OnPaint(PaintEventArgs e)
 
        {
 
            using (UseAntiAlias antiAlias = new UseAntiAlias(e.Graphics))
 
            {
 
                Graphics graphics = e.Graphics;
 
                        DrawProgressBar(
 
                            graphics,
 
                            this.ClientRectangle,
 
                            this.m_backgroundColor,
 
                            this.m_valueColor,
 
                            this.m_borderColor,
 
                            this.RightToLeft,
 
                            this.Minimum,
 
                            this.Maximum,
 
                            this.Value);
 
 
                if (string.IsNullOrEmpty(this.Text) == false)
 
                {
 
                    using (UseClearTypeGridFit useClearTypeGridFit = new UseClearTypeGridFit(graphics))
 
                    {
 
                        using (SolidBrush textBrush = new SolidBrush(this.ForeColor))
 
                        {
 
                            using (StringFormat stringFormat = new StringFormat())
 
                            {
 
                                stringFormat.FormatFlags = StringFormatFlags.NoWrap;
 
                                if (this.RightToLeft == RightToLeft.Yes)
 
                                {
 
                                    stringFormat.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
 
                                }
 
                                stringFormat.Trimming = StringTrimming.EllipsisCharacter;
 
                                stringFormat.LineAlignment = StringAlignment.Center;
 
                                stringFormat.Alignment = StringAlignment.Center;
 
 
                                Rectangle stringRectangle = this.ClientRectangle;
 
                                graphics.DrawString(this.Text, this.Font, textBrush, stringRectangle, stringFormat);
 
                            }
 
                        }
 
                    }
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the BorderColor changed event.
 
        /// </summary>
 
        /// <param name="sender">The source of the event.</param>
 
        /// <param name="e">A EventArgs that contains the event data.</param>
 
		protected virtual void OnBorderColorChanged(object sender, EventArgs e)
 
        {
 
            this.Invalidate(true);
 
            if (this.BorderColorChanged != null)
 
            {
 
                this.BorderColorChanged(sender, e);
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the BackgroundColor changed event.
 
        /// </summary>
 
        /// <param name="sender">The source of the event.</param>
 
        /// <param name="e">A EventArgs that contains the event data.</param>
 
        protected virtual void OnBackgroundColorChanged(object sender, EventArgs e)
 
        {
 
            Invalidate();
 
            if (this.BackgroundColorChanged != null)
 
            {
 
                this.BackgroundColorChanged(sender, e);
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the ValueColor changed event.
 
        /// </summary>
 
        /// <param name="sender">The source of the event.</param>
 
        /// <param name="e">A EventArgs that contains the event data.</param>
 
        protected virtual void OnValueColorChanged(object sender, EventArgs e)
 
        {
 
            Invalidate(true);
 
            if (this.ValueColorChanged != null)
 
            {
 
                this.ValueColorChanged(sender, e);
 
            }
 
        }
 
        #endregion
 
 
        #region MethodsPrivate
 
        private void UpdatePos()
 
        {
 
            this.Invalidate(true);
 
        }
 
 
        private static void DrawProgressBar(
 
            Graphics graphics,
 
            Rectangle clientRectangle,
 
            Color colorBackgroundEnd,
 
            Color colorValueEnd,
 
            Color borderColor,
 
            RightToLeft rightToLeft,
 
            int iMinimum,
 
            int iMaximum,
 
            int iValue)
 
        {
 
 
            Rectangle outerRectangle = GetRectangleBackground(clientRectangle);
 
 
            using (GraphicsPath outerRectangleGraphicsPath = GetBackgroundPath(outerRectangle, 4))
 
            {
 
                if (outerRectangleGraphicsPath != null)
 
                {
 
                    using (LinearGradientBrush gradientBrush = GetGradientBackBrush(outerRectangle, colorBackgroundEnd))
 
                    {
 
                        if (gradientBrush != null)
 
                        {
 
                            graphics.FillPath(gradientBrush, outerRectangleGraphicsPath);
 
                        }
 
                    }
 
 
                    // Draws the value rectangle
 
                    if (iValue > 0)
 
                    {
 
                        Rectangle valueRectangle = GetRectangleValue(outerRectangle, rightToLeft, iMinimum, iMaximum, iValue);
 
                        using (GraphicsPath valueGraphicsPath = GetValuePath(valueRectangle, rightToLeft, 5))
 
                        {
 
                            using (LinearGradientBrush gradientBrush = GetGradientBackBrush(valueRectangle, colorValueEnd))
 
                            {
 
                                if (gradientBrush != null)
 
                                {
 
                                    graphics.FillPath(gradientBrush, valueGraphicsPath);
 
                                }
 
                            }
 
                        }
 
                    }
 
                    using (Pen borderPen = new Pen(borderColor))
 
                    {
 
                        graphics.DrawPath(borderPen, outerRectangleGraphicsPath);
 
                    }
 
                }
 
            }
 
        }
 
        private static Rectangle GetRectangleBackground(Rectangle clientRectangle)
 
        {
 
            Rectangle rectangleBackground = clientRectangle;
 
            rectangleBackground.Inflate(-1, -1);
 
            return rectangleBackground;
 
        }
 
        private static Rectangle GetRectangleValue(Rectangle backgroundRectangle, RightToLeft rightToLeft, int iMinimum, int iMaximum, int iValue)
 
        {
 
            Rectangle valueRectangle = backgroundRectangle;
 
            int iProgressRange = iMaximum - iMinimum;
 
            int iValueRange = iValue - iMinimum;
 
            int iRange = (int)((float)iValueRange / (float)iProgressRange * backgroundRectangle.Width);
 
            valueRectangle.Width = iRange;
 
            if (rightToLeft == RightToLeft.Yes)
 
            {
 
                valueRectangle.X = backgroundRectangle.Width - valueRectangle.Width;
 
            }
 
            return valueRectangle;
 
        }
 
        private static GraphicsPath GetBackgroundPath(Rectangle bounds, int radius)
 
        {
 
            int x = bounds.X;
 
            int y = bounds.Y;
 
            int width = bounds.Width;
 
            int height = bounds.Height;
 
            GraphicsPath graphicsPath = new GraphicsPath();
 
            graphicsPath.AddArc(x, y, radius, radius, 180, 90);				                    //Upper left corner
 
            graphicsPath.AddArc(x + width - radius, y, radius, radius, 270, 90);			    //Upper right corner
 
            graphicsPath.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);//Lower right corner
 
            graphicsPath.AddArc(x, y + height - radius, radius, radius, 90, 90);			    //Lower left corner
 
            graphicsPath.CloseFigure();
 
            return graphicsPath;
 
        }
 
 
        private static GraphicsPath GetValuePath(Rectangle bounds, RightToLeft rightToLeft, int radius)
 
        {
 
            int x = bounds.X;
 
            int y = bounds.Y;
 
            int width = bounds.Width;
 
            int height = bounds.Height;
 
            GraphicsPath graphicsPath = new GraphicsPath();
 
            if (rightToLeft == RightToLeft.No)
 
            {
 
                graphicsPath.AddArc(x, y, radius, radius, 180, 90);				                    //Upper left corner
 
                graphicsPath.AddLine(x + radius, y, x + width, y);                                  //Upper line
 
                graphicsPath.AddLine(x + width, y, x + width, y + height);                          //Right line
 
                graphicsPath.AddArc(x, y + height - radius, radius, radius, 90, 90);			    //Lower left corner
 
            }
 
            else
 
            {
 
                graphicsPath.AddLine(x, y, width - radius, y);                                      //Upper Line
 
                graphicsPath.AddArc(x + width - radius, y, radius, radius, 270, 90);                // Upper right corner
 
                graphicsPath.AddLine(x + width, y + radius, x + width, y + radius + height - (2 * radius)); // right line
 
                graphicsPath.AddArc(x + width - radius, y + radius + height - (2 * radius), radius, radius, 360, 90); // Lower right corner
 
                graphicsPath.AddLine(x + width - radius, y + height, x, y + height);                // Lower line
 
            }
 
            graphicsPath.CloseFigure();
 
            return graphicsPath;
 
        }
 
 
        private static LinearGradientBrush GetGradientBackBrush(Rectangle bounds, Color backColor)
 
        {
 
            if (IsZeroWidthOrHeight(bounds))
 
            {
 
                return null;
 
            }
 
            LinearGradientBrush linearGradientBrush = linearGradientBrush = new LinearGradientBrush(bounds, Color.White, backColor, LinearGradientMode.Vertical);
 
            if (linearGradientBrush != null)
 
            {
 
                Blend blend = new Blend();
 
                blend.Positions = new float[] { 0.0F, 0.2F, 0.3F, 0.5F, 0.6F, 0.8F, 1.0F };
 
                blend.Factors = new float[] { 0.3F, 0.4F, 0.5F, 0.8F, 1.0F, 1.0F, 0.9F };
 
                linearGradientBrush.Blend = blend;
 
            }
 
            return linearGradientBrush;
 
        }
 
        /// <summary>
 
        /// Checks if the rectangle width or height is equal to 0.
 
        /// </summary>
 
        /// <param name="rectangle">the rectangle to check</param>
 
        /// <returns>true if the with or height of the rectangle is 0 else false</returns>
 
        private static bool IsZeroWidthOrHeight(Rectangle rectangle)
 
        {
 
            if (rectangle.Width != 0)
 
            {
 
                return (rectangle.Height == 0);
 
            }
 
            return true;
 
        }
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/ProgressBar/ToolStripProgressBar.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
using System.Windows.Forms;
 
using System.Windows.Forms.Design;
 
using System.Drawing;
 
using System.ComponentModel;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Represents a Windows progress bar control contained in a StatusStrip.
 
    /// </summary>
 
    [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)]
 
    [ToolboxBitmap(typeof(System.Windows.Forms.ProgressBar))]
 
    public class ToolStripProgressBar : ToolStripControlHost
 
    {
 
        #region Events
 
        #endregion
 
 
        #region Constants
 
        #endregion
 
 
        #region FieldsPrivate
 
        #endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets the ProgressBar.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="BSE.Windows.Forms.ProgressBar"/>
 
        /// A ProgressBar.
 
        /// </value>
 
        public ProgressBar ProgressBar
 
        {
 
            get { return base.Control as ProgressBar; }
 
        }
 
        /// <summary>
 
        /// Gets or sets a value indicating whether items are to be placed from right to left
 
        /// and text is to be written from right to left.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Windows.Forms.RightToLeft"/>
 
        /// true if items are to be placed from right to left and text is to be written from right to left; otherwise, false.
 
        /// </value>
 
        public override RightToLeft RightToLeft
 
        {
 
            get { return this.ProgressBar.RightToLeft; }
 
            set { this.ProgressBar.RightToLeft = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the color used for the background rectangle for this <see cref="ToolStripProgressBar"/>.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Color"/>
 
        /// A Color used for the background rectangle of this ToolStripProgressBar.
 
        /// </value>
 
        [Browsable(true)]
 
        [Category("Appearance")]
 
        [Description("The color used for the background rectangle of this control.")]
 
        public Color BackgroundColor
 
        {
 
            get { return this.ProgressBar.BackgroundColor; }
 
            set { this.ProgressBar.BackgroundColor = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the color used for the value rectangle of this control.
 
        /// Gets or sets color used for the value rectangle for this <see cref="ToolStripProgressBar"/>.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Color"/>
 
        /// A Color used for the value rectangle for this ToolStripProgressBar.
 
        /// </value>
 
        [Browsable(true)]
 
        [Category("Appearance")]
 
        [Description("The end color of the gradient used for the value rectangle of this control.")]
 
        public Color ValueColor
 
        {
 
            get { return this.ProgressBar.ValueColor; }
 
            set { this.ProgressBar.ValueColor = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the foreground color of the hosted control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Color"/>
 
        /// A <see cref="Color"/> representing the foreground color of the hosted control.
 
        /// </value>
 
        [Browsable(true)]
 
        [Category("Appearance")]
 
        [Description("The Foreground color used to display text on the progressbar")]
 
        public override Color ForeColor
 
        {
 
            get { return this.ProgressBar.ForeColor; }
 
            set { this.ProgressBar.ForeColor = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the font to be used on the hosted control.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Font"/>
 
        /// The Font for the hosted control.
 
        /// </value>
 
        [Category("Appearance")]
 
        [Description("The font used to display text on the progressbar")]
 
        public override Font Font
 
        {
 
            get { return this.ProgressBar.Font; }
 
            set { this.ProgressBar.Font = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the upper bound of the range that is defined for this <see cref="ToolStripProgressBar"/>.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Int32"/>
 
        /// An integer representing the upper bound of the range. The default is 100.
 
        /// </value>
 
        [Category("Behavior")]
 
        [DefaultValue(100)]
 
        [RefreshProperties(RefreshProperties.All)]
 
        [Description("The upper bound of the range this progressbar is working with.")]
 
        public int Maximum
 
        {
 
            get { return this.ProgressBar.Maximum; }
 
            set { this.ProgressBar.Maximum = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the lower bound of the range that is defined for this <see cref="ToolStripProgressBar"/>.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Int32"/>
 
        /// An integer representing the lower bound of the range. The default is 0.
 
        /// </value>
 
        [Category("Behavior")]
 
        [DefaultValue(0)]
 
        [RefreshProperties(RefreshProperties.All)]
 
        [Description("The lower bound of the range this progressbar is working with.")]
 
        public int Minimum
 
        {
 
            get { return this.ProgressBar.Minimum; }
 
            set { this.ProgressBar.Minimum = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the current value of the <see cref="ToolStripProgressBar"/>.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Int32"/>
 
        /// An integer representing the current value.
 
        /// </value>
 
        [Category("Behavior")]
 
        [DefaultValue(0)]
 
        [RefreshProperties(RefreshProperties.All)]
 
        [Description("The current value for the progressbar, in the range specified by the minimum and maximum.")]
 
        public int Value
 
        {
 
            get { return this.ProgressBar.Value; }
 
            set { this.ProgressBar.Value = value; }
 
        }
 
        /// <summary>
 
        /// Gets or sets the text displayed on the <see cref="BSE.Windows.Forms.ToolStripProgressBar"/>.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.String"/>
 
        /// A <see cref="System.String"/> representing the display text.
 
        /// </value>
 
        [Category("Behavior")]
 
        [Description("The text to display on the progressbar")]
 
        public override string Text
 
        {
 
            get { return this.ProgressBar.Text; }
 
            set { this.ProgressBar.Text = value; }
 
        }
 
        /// <summary>
 
        /// Gets the height and width of the ToolStripProgressBar in pixels.
 
        /// </summary>
 
        /// <value>
 
        /// Type: <see cref="System.Drawing.Size"/>
 
        /// A Point value representing the height and width.
 
        /// </value>
 
        protected override Size DefaultSize
 
        {
 
            get { return new Size(100, 15); }
 
        }
 
        /// <summary>
 
        /// Gets the spacing between the <see cref="ToolStripProgressBar"/> and adjacent items.
 
        /// </summary>
 
        protected override Padding DefaultMargin
 
        {
 
            get
 
            {
 
                if ((base.Owner != null) && (base.Owner is StatusStrip))
 
                {
 
                    return new Padding(1, 3, 1, 3);
 
                }
 
                return new Padding(1, 1, 1, 2);
 
            }
 
        }
 
        #endregion
 
 
        #region MethodsPublic
 
        /// <summary>
 
        /// Initializes a new instance of the ToolStripProgressBar class. 
 
        /// </summary>
 
        public ToolStripProgressBar()
 
            : base(CreateControlInstance())
 
        {
 
        }
 
        #endregion
 
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Raises the OwnerChanged event. 
 
        /// </summary>
 
        /// <param name="e">An EventArgs that contains the event data.</param>
 
        protected override void OnOwnerChanged(EventArgs e)
 
        {
 
            if (base.Owner != null)
 
            {
 
                base.Owner.RendererChanged += new EventHandler(OwnerRendererChanged);
 
            }
 
            base.OnOwnerChanged(e);
 
        }
 
        #endregion
 
 
        #region MethodsPrivate
 
        private static Control CreateControlInstance()
 
        {
 
            BSE.Windows.Forms.ProgressBar progressBar = new BSE.Windows.Forms.ProgressBar();
 
            progressBar.Size = new Size(100, 15);
 
 
            return progressBar;
 
        }
 
        private void OwnerRendererChanged(object sender, EventArgs e)
 
        {
 
            ToolStripRenderer toolsTripRenderer = this.Owner.Renderer;
 
            if (toolsTripRenderer != null)
 
            {
 
                if (toolsTripRenderer is BseRenderer)
 
                {
 
                    ToolStripProfessionalRenderer renderer = toolsTripRenderer as ToolStripProfessionalRenderer;
 
                        if (renderer != null)
 
                        {
 
                            this.ProgressBar.BorderColor = renderer.ColorTable.ToolStripBorder;
 
                        }
 
                    if (this.Owner.GetType() != typeof(StatusStrip))
 
                    {
 
                        this.Margin = new Padding(1, 1, 1, 3);
 
                    }
 
                }
 
                else
 
                {
 
                    this.Margin = DefaultMargin;
 
                }
 
            }
 
        }
 
        #endregion
 
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/BseColorTable.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Baseclass for a colortable for the <see cref="BseRenderer"/>
 
    /// </summary>
 
    public class BseColorTable : BSE.Windows.Forms.ProfessionalColorTable
 
    {
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/BseRenderer.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Drawing.Text;
 
using System.Drawing.Drawing2D;
 
using System.Windows.Forms;
 
using System.Diagnostics;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Draw ToolStrips using the Office 2007 themed appearance.
 
    /// </summary>
 
    public class BseRenderer : ToolStripProfessionalRenderer
 
    {
 
        #region FieldsPrivate
 
        private static Rectangle[] baseSizeGripRectangles;
 
        private static int MarginInset;
 
        private static Blend MenuItemBlend;
 
        private static Blend ButtonBlend;
 
        #endregion
 
 
		#region MethodsPublic
 
		static BseRenderer()
 
        {
 
            MarginInset = 2;
 
            
 
            // One time creation of the blend for the button gradient brush
 
            ButtonBlend = new Blend();
 
            ButtonBlend.Positions = new float[] { 0.0F, 0.1F, 0.2F, 0.5F, 1.0F };
 
            ButtonBlend.Factors = new float[] { 0.6F, 0.7F, 0.8F, 1.0F, 1.0F };
 
            // One time creation of the blend for the menuitem gradient brush
 
            MenuItemBlend = new Blend();
 
            MenuItemBlend.Positions = new float[] { 0.0F, 0.1F, 0.2F, 0.5F, 1.0F };
 
            MenuItemBlend.Factors = new float[] { 0.7F, 0.8F, 0.9F, 1.0F, 1.0F };
 
 
            baseSizeGripRectangles = new Rectangle[] { new Rectangle(8, 0, 2, 2), new Rectangle(8, 4, 2, 2), new Rectangle(8, 8, 2, 2), new Rectangle(4, 4, 2, 2), new Rectangle(4, 8, 2, 2), new Rectangle(0, 8, 2, 2) };
 
        }
 
        /// <summary>
 
        /// Initialize a new instance of the BseRenderer class.
 
        /// </summary>
 
        public BseRenderer()
 
            : base(new BSE.Windows.Forms.ColorTableBlack())
 
        {
 
			this.ColorTable.UseSystemColors = false;
 
		}
 
        /// <summary>
 
        /// Initializes a new instance of the BseRenderer class.
 
        /// </summary>
 
        /// <param name="professionalColorTable">A <see cref="BSE.Windows.Forms.ProfessionalColorTable"/> to be used for painting.</param>
 
        public BseRenderer(ProfessionalColorTable professionalColorTable)
 
            : base(professionalColorTable)
 
        {
 
        }
 
        #endregion
 
 
		#region MethodsProtected
 
        /// <summary>
 
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderArrow"/> event.
 
        /// </summary>
 
        /// <param name="e">A <see cref="System.Windows.Forms.ToolStripArrowRenderEventArgs"/> that contains the event data.</param>
 
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 
        {
 
            if (ColorTable.UseSystemColors == true)
 
            {
 
                base.OnRenderArrow(e);
 
            }
 
            else
 
            {
 
                ProfessionalColorTable colorTable = ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
 
                if ((colorTable != null) && (e.Item.Enabled == true))
 
                {
 
                    if (e.Item.Owner is MenuStrip)
 
                    {
 
                        e.ArrowColor = colorTable.MenuItemText;
 
                    }
 
                    else if (e.Item.Owner is StatusStrip)
 
                    {
 
                        e.ArrowColor = colorTable.StatusStripText;
 
                    }
 
                    else
 
                    {
 
                        if (e.Item.Owner.GetType() != typeof(ToolStripDropDownMenu))
 
                        {
 
                            e.ArrowColor = colorTable.ToolStripText;
 
                        }
 
                    }
 
                }
 
                base.OnRenderArrow(e);
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderButtonBackground"/> event.
 
        /// </summary>
 
        /// <param name="e">A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the event data.</param>
 
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
 
        {
 
            if (ColorTable.UseSystemColors == true)
 
            {
 
                base.OnRenderDropDownButtonBackground(e);
 
            }
 
            else
 
            {
 
                ToolStripButton item = e.Item as ToolStripButton;
 
                Rectangle buttonBounds = new Rectangle(Point.Empty, item.Size);
 
                if (IsZeroWidthOrHeight(buttonBounds) == true)
 
                {
 
                    return;
 
                }
 
                Graphics graphics = e.Graphics;
 
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
 
                if (colorTable != null)
 
                {
 
                    using (UseAntiAlias antiAlias = new UseAntiAlias(graphics))
 
                    {
 
                        Rectangle buttonRectangle = GetButtonRectangle(buttonBounds);
 
 
                        if (item.Checked == true)
 
                        {
 
                            //Draws the border of the button for the checked ToolStripButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonPressedBorder);
 
                        }
 
                        if ((item.Selected == true) && (item.Pressed == false))
 
                        {
 
                            //Renders the upper button part of the selected ToolStripButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            //Draws the border of the button for the selected ToolStripButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                            //DrawButtonBorder(graphics, buttonRectangle, Color.FromArgb(196, 194, 196));
 
                        }
 
                        if (item.Pressed == true)
 
                        {
 
                            //Renders the upper button part of the pressed ToolStripButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemPressedGradientBegin);
 
                            //Draws the inner border of the button for the pressed ToolStripButton control
 
                            DrawInnerButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                            //Draws the outer border of the button for the pressed ToolStripButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.MenuBorder);
 
                        }
 
                    }
 
                }
 
                else
 
                {
 
                    base.OnRenderDropDownButtonBackground(e);
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderDropDownButtonBackground"/> event.
 
        /// </summary>
 
        /// <param name="e">A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the event data.</param>
 
        protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
 
        {
 
            if (ColorTable.UseSystemColors == true)
 
            {
 
                base.OnRenderDropDownButtonBackground(e);
 
            }
 
            else
 
            {
 
                ToolStripDropDownButton item = e.Item as ToolStripDropDownButton;
 
                Rectangle buttonBounds = new Rectangle(Point.Empty, item.Size);
 
                if (IsZeroWidthOrHeight(buttonBounds) == true)
 
                {
 
                    return;
 
                }
 
                Graphics graphics = e.Graphics;
 
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
 
 
                if (colorTable != null)
 
                {
 
                    using (UseAntiAlias antiAlias = new UseAntiAlias(graphics))
 
                    {
 
                        Rectangle buttonRectangle = GetButtonRectangle(buttonBounds);
 
                        if ((item.Selected == true) && (item.Pressed == false))
 
                        {
 
                            //Renders the upper button part of the selected ToolStripDropDownButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            //Draws the border of the button for the selected ToolStripDropDownButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                        }
 
                        if (item.Pressed == true)
 
                        {
 
                            //Renders the upper button part of the pressed ToolStripDropDownButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemPressedGradientBegin);
 
                            //Draws the inner border of the button for the pressed ToolStripDropDownButton control
 
                            DrawInnerButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                            //Draws the outer border of the button for the pressed ToolStripDropDownButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.MenuBorder);
 
                        }
 
                    }
 
                }
 
                else
 
                {
 
                    base.OnRenderDropDownButtonBackground(e);
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.OnRenderSplitButtonBackground"/> event.
 
        /// </summary>
 
        /// <param name="e">A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the event data.</param>
 
        protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
 
        {
 
            if (ColorTable.UseSystemColors == true)
 
            {
 
                base.OnRenderDropDownButtonBackground(e);
 
            }
 
            else
 
            {
 
                ToolStripSplitButton item = e.Item as ToolStripSplitButton;
 
                Rectangle buttonBounds = new Rectangle(Point.Empty, item.ButtonBounds.Size);
 
                if (IsZeroWidthOrHeight(buttonBounds) == true)
 
                {
 
                    return;
 
                }
 
                Graphics graphics = e.Graphics;
 
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
 
                if (colorTable != null)
 
                {
 
                    using (UseAntiAlias antiAlias = new UseAntiAlias(graphics))
 
                    {
 
                        Rectangle buttonRectangle = GetButtonRectangle(buttonBounds);
 
                        Rectangle dropDownButtonBounds = new Rectangle(item.DropDownButtonBounds.Location, item.DropDownButtonBounds.Size);
 
                        Rectangle dropDownButtonRectangle = GetButtonRectangle(dropDownButtonBounds);
 
 
                        if ((item.Selected == true) && (item.Pressed == false) && (item.ButtonPressed == false))
 
                        {
 
                            //Renders the upper button part of the selected ToolStripSplitButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            //Renders the dropDownButton part of the selected ToolStripSplitButton control
 
                            RenderButton(graphics, dropDownButtonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            //Draws the border of the button part for the selected ToolStripSplitButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                            //Draws the border of the dropDownButton part for the selected ToolStripSplitButton control
 
                            DrawButtonBorder(graphics, dropDownButtonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                        }
 
                        if (item.ButtonPressed == true)
 
                        {
 
                            //Renders the upper button part of the pressed ToolStripSplitButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemPressedGradientBegin);
 
                            //Renders the dropDownButton part of the pressed ToolStripSplitButton control
 
                            RenderButton(graphics, dropDownButtonRectangle, colorTable.MenuItemPressedGradientBegin);
 
                            //Draws the inner border of the button part for the pressed ToolStripSplitButton control
 
                            DrawInnerButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                            //Draws the outer border of the button part for the pressed ToolStripSplitButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.MenuBorder);
 
                            //Draws the inner border of the dropDownButton part for the pressed ToolStripSplitButton control
 
                            DrawInnerButtonBorder(graphics, dropDownButtonRectangle, colorTable.ButtonSelectedHighlightBorder);
 
                            //Draws the outer border of the dropDownButton part for the pressed ToolStripSplitButton control
 
                            DrawButtonBorder(graphics, dropDownButtonRectangle, colorTable.MenuBorder);
 
                        }
 
                        if (item.DropDownButtonPressed == true)
 
                        {
 
                            //Renders the upper button part of the pressed ToolStripSplitButton control
 
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            //Renders the dropDownButton part of the pressed ToolStripSplitButton control
 
                            RenderButton(graphics, dropDownButtonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            //Draws the border of the button part for the pressed ToolStripSplitButton control
 
                            DrawButtonBorder(graphics, buttonRectangle, ColorTable.ButtonSelectedHighlightBorder);
 
                            //Draws the border of the dropDownButton part for the pressed ToolStripSplitButton control
 
                            DrawButtonBorder(graphics, dropDownButtonRectangle, ColorTable.ButtonSelectedHighlightBorder);
 
                        }
 
                        if (e.Item.Owner is MenuStrip)
 
                        {
 
                            base.DrawArrow(new ToolStripArrowRenderEventArgs(graphics, item, dropDownButtonBounds, colorTable.MenuItemText, ArrowDirection.Down));
 
                        }
 
                        if (e.Item.Owner is StatusStrip)
 
                        {
 
                            base.DrawArrow(new ToolStripArrowRenderEventArgs(graphics, item, dropDownButtonBounds, colorTable.StatusStripText, ArrowDirection.Down));
 
                        }
 
                        if (e.Item.Owner is ToolStrip)
 
                        {
 
                            base.DrawArrow(new ToolStripArrowRenderEventArgs(graphics, item, dropDownButtonBounds, colorTable.ToolStripText, ArrowDirection.Down));
 
                        }
 
                    }
 
                }
 
                else
 
                {
 
                    base.OnRenderDropDownButtonBackground(e);
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderMenuItemBackground"/> event. 
 
        /// </summary>
 
        /// <param name="e">A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the event data.</param>
 
        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
 
        {
 
            ToolStripMenuItem item = e.Item as ToolStripMenuItem;
 
            Rectangle bounds = new Rectangle(Point.Empty, item.Size);
 
            if (IsZeroWidthOrHeight(bounds) == true)
 
            {
 
                return;
 
            }
 
            Graphics graphics = e.Graphics;
 
            ProfessionalColorTable colorTable = ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
 
            if (colorTable != null)
 
            {
 
                using (UseAntiAlias useAntiAlias = new UseAntiAlias(graphics))
 
                {
 
                    if (e.ToolStrip is MenuStrip)
 
                    {
 
                        if ((item.Selected == true) && (item.Pressed == false))
 
                        {
 
                            RenderMenuItem(graphics, bounds, colorTable.MenuItemTopLevelSelectedGradientBegin);
 
                            ControlPaint.DrawBorder(e.Graphics, bounds, colorTable.MenuItemTopLevelSelectedBorder, ButtonBorderStyle.Solid);
 
                        }
 
                        if (item.Pressed == true)
 
                        {
 
                            RenderButton(graphics, bounds, ColorTable.MenuItemPressedGradientBegin);
 
                            Rectangle innerBorderRectangle = bounds;
 
                            innerBorderRectangle.Inflate(-1, -1);
 
                            ControlPaint.DrawBorder(e.Graphics, innerBorderRectangle, ColorTable.ButtonSelectedHighlightBorder, ButtonBorderStyle.Solid);
 
                            ControlPaint.DrawBorder(e.Graphics, bounds, ColorTable.MenuBorder, ButtonBorderStyle.Solid);
 
                        }
 
                    }
 
                    else
 
                    {
 
                        base.OnRenderMenuItemBackground(e);
 
                    }
 
                }
 
            }
 
            else
 
            {
 
                base.OnRenderMenuItemBackground(e);
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the RenderItemText event.
 
        /// </summary>
 
        /// <param name="e">A ToolStripItemTextRenderEventArgs that contains the event data.</param>
 
        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				ProfessionalColorTable colorTable = ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
 
				if (colorTable != null)
 
				{
 
                    if ((e.ToolStrip is MenuStrip))// && (e.Item.Selected == false) && e.Item.Pressed == false)
 
                    {
 
                        if (colorTable.MenuItemText != Color.Empty)
 
                        {
 
                            e.TextColor = colorTable.MenuItemText;
 
                        }
 
                    }
 
                    else if ((e.ToolStrip is StatusStrip))// && (e.Item.Selected == false) && e.Item.Pressed == false)
 
                    {
 
                        if (colorTable.StatusStripText != Color.Empty)
 
                        {
 
                            e.TextColor = colorTable.StatusStripText;
 
                        }
 
                    }
 
                    else if (e.ToolStrip is ToolStripDropDown)
 
                    {
 
                        //base.OnRenderItemText(e);
 
                    }
 
                    else
 
                    {
 
                        if (colorTable.ToolStripText != Color.Empty)
 
                        {
 
                            e.TextColor = colorTable.ToolStripText;
 
                        }
 
                    }
 
				}
 
			}
 
            base.OnRenderItemText(e);
 
        }
 
        /// <summary>
 
        /// Raises the RenderToolStripContentPanelBackground event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripContentPanelRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
 
        {
 
            // Must call base class, otherwise the subsequent drawing does not appear!
 
            base.OnRenderToolStripContentPanelBackground(e);
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				// Cannot paint a zero sized area
 
				if ((e.ToolStripContentPanel.Width > 0) &&
 
					(e.ToolStripContentPanel.Height > 0))
 
				{
 
					using (LinearGradientBrush backBrush = new LinearGradientBrush(e.ToolStripContentPanel.ClientRectangle,
 
																				   ColorTable.ToolStripContentPanelGradientBegin,
 
																				   ColorTable.ToolStripContentPanelGradientEnd,
 
																				   LinearGradientMode.Vertical))
 
					{
 
						e.Graphics.FillRectangle(backBrush, e.ToolStripContentPanel.ClientRectangle);
 
					}
 
				}
 
			}
 
        }
 
        /// <summary>
 
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderOverflowButtonBackground"/> event.
 
        /// </summary>
 
        /// <param name="e">A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the event data.</param>
 
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
 
        {
 
            base.OnRenderOverflowButtonBackground(e);
 
            ToolStripItem item = e.Item;
 
            if ((item.Selected == false) && (item.Pressed == false))
 
            {
 
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
 
                if (colorTable != null)
 
                {
 
                    Graphics graphics = e.Graphics;
 
                    bool bRightToLeft = item.RightToLeft == RightToLeft.Yes;
 
 
                    bool bOrientation = e.ToolStrip.Orientation == Orientation.Horizontal;
 
                    Rectangle arrowRectangle = Rectangle.Empty;
 
                    if (bRightToLeft)
 
                    {
 
                        arrowRectangle = new Rectangle(0, item.Height - 8, 9, 5);
 
                    }
 
                    else
 
                    {
 
                        arrowRectangle = new Rectangle(item.Width - 12, item.Height - 8, 9, 5);
 
                    }
 
 
                    ArrowDirection arrowDirection = bOrientation ? ArrowDirection.Down : ArrowDirection.Right;
 
                    int x = (bRightToLeft && bOrientation) ? -1 : 1;
 
                    arrowRectangle.Offset(x, 1);
 
                    RenderArrowInternal(graphics, arrowRectangle, arrowDirection, colorTable.ToolStripGradientMiddle);
 
                    arrowRectangle.Offset(-1 * x, -1);
 
                    RenderArrowInternal(graphics, arrowRectangle, arrowDirection, colorTable.ToolStripText);
 
                    if (bOrientation)
 
                    {
 
                        x = bRightToLeft ? -2 : 0;
 
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripText, (int)(arrowRectangle.Right - 6), (int)(arrowRectangle.Y - 2), (int)(arrowRectangle.Right - 2), (int)(arrowRectangle.Y - 2));
 
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripGradientMiddle, (int)((arrowRectangle.Right - 5) + x), (int)(arrowRectangle.Y - 1), (int)((arrowRectangle.Right - 1) + x), (int)(arrowRectangle.Y - 1));
 
                    }
 
                    else
 
                    {
 
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripText, arrowRectangle.X, arrowRectangle.Y, arrowRectangle.X, arrowRectangle.Bottom - 1);
 
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripGradientMiddle, arrowRectangle.X + 1, arrowRectangle.Y + 1, arrowRectangle.X + 1, arrowRectangle.Bottom);
 
                    }
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the RenderSeparator event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripSeparatorRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				e.Item.ForeColor = ColorTable.RaftingContainerGradientBegin;
 
			}
 
            base.OnRenderSeparator(e);
 
        }
 
        /// <summary>
 
        /// Raises the RenderStatusStripSizingGrip event.
 
        /// </summary>
 
        /// <param name="e">A ToolStripRenderEventArgs that contains the event data.</param>
 
        protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
 
        {
 
            Graphics graphics = e.Graphics;
 
            StatusStrip toolStrip = e.ToolStrip as StatusStrip;
 
            if (toolStrip != null)
 
            {
 
                Rectangle sizeGripBounds = toolStrip.SizeGripBounds;
 
                if (IsZeroWidthOrHeight(sizeGripBounds) == false)
 
                {
 
                    Rectangle[] rectanglesLight = new Rectangle[baseSizeGripRectangles.Length];
 
                    Rectangle[] rectanglesDark = new Rectangle[baseSizeGripRectangles.Length];
 
                    for (int i = 0; i < baseSizeGripRectangles.Length; i++)
 
                    {
 
                        Rectangle rectangleDark = baseSizeGripRectangles[i];
 
                        if (toolStrip.RightToLeft == RightToLeft.Yes)
 
                        {
 
                            rectangleDark.X = (sizeGripBounds.Width - rectangleDark.X) - rectangleDark.Width;
 
                        }
 
                        rectangleDark.Offset(sizeGripBounds.X, sizeGripBounds.Bottom - 12);
 
                        rectanglesLight[i] = rectangleDark;
 
                        if (toolStrip.RightToLeft == RightToLeft.Yes)
 
                        {
 
                            rectangleDark.Offset(1, -1);
 
                        }
 
                        else
 
                        {
 
                            rectangleDark.Offset(-1, -1);
 
                        }
 
                        rectanglesDark[i] = rectangleDark;
 
                    }
 
                    using (SolidBrush darkBrush = new SolidBrush(ColorTable.GripDark),
 
                        lightBrush = new SolidBrush(ColorTable.GripDark))
 
                    {
 
                        graphics.FillRectangles(lightBrush, rectanglesLight);
 
                        graphics.FillRectangles(darkBrush, rectanglesDark);
 
                    }
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the RenderToolStripBackground event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
 
        {
 
            if (ColorTable.UseSystemColors == true)
 
            {
 
                base.OnRenderToolStripBackground(e);
 
            }
 
            else
 
            {
 
                Trace.WriteLine("ToolStrip: " + e.ToolStrip.GetType());
 
                Rectangle backgroundRectangle = new Rectangle(0, 0, e.ToolStrip.Width, e.ToolStrip.Height);
 
                Rectangle innerRectangle = backgroundRectangle;
 
                innerRectangle.Height = (backgroundRectangle.Height / 2) + 1;
 
                // Cannot paint a zero sized area
 
                if ((backgroundRectangle.Width > 0) && (backgroundRectangle.Height > 0))
 
                {
 
                    if (e.ToolStrip is StatusStrip)
 
                    {
 
                        using (SolidBrush outerBrush = new SolidBrush(ColorTable.StatusStripGradientEnd))
 
                        {
 
                            e.Graphics.FillRectangle(outerBrush, backgroundRectangle);
 
                        }
 
 
                        int y2 = backgroundRectangle.Height / 2;
 
                        Rectangle upperRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, y2);
 
                        upperRectangle.Height += 1;
 
                        using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush(
 
                            upperRectangle,
 
                            ColorTable.StatusStripGradientBegin,
 
                            Color.FromArgb(128,ColorTable.StatusStripGradientBegin),
 
                            LinearGradientMode.Vertical))
 
                        {
 
                            e.Graphics.FillRectangle(innerRectangleBrush, upperRectangle); //draw top bubble
 
                        }
 
 
                        y2 = (backgroundRectangle.Height / 4) + 1;
 
                        Rectangle lowerRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Height - y2, backgroundRectangle.Width, y2);
 
 
                        using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush(
 
                            lowerRectangle,
 
                            ColorTable.StatusStripGradientEnd,
 
                            Color.FromArgb(128,ColorTable.StatusStripGradientBegin),
 
                            LinearGradientMode.Vertical))
 
                        {
 
                            e.Graphics.FillRectangle(innerRectangleBrush, lowerRectangle); //draw top bubble
 
                        }
 
                    }
 
                    else if (e.ToolStrip is MenuStrip)
 
                    {
 
                        using (SolidBrush outerBrush = new SolidBrush(ColorTable.MenuStripGradientEnd))
 
                        {
 
                            e.Graphics.FillRectangle(outerBrush, backgroundRectangle);
 
                        }
 
 
                        int y2 = backgroundRectangle.Height / 3;
 
                        Rectangle lowerRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, y2);
 
 
                        using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush(
 
                            lowerRectangle,
 
                            ColorTable.MenuStripGradientBegin,
 
                            Color.FromArgb(128, ColorTable.StatusStripGradientBegin),
 
                            LinearGradientMode.Vertical))
 
                        {
 
                            e.Graphics.FillRectangle(innerRectangleBrush, lowerRectangle); //draw top bubble
 
                        }
 
                    }
 
                    else if (e.ToolStrip is ToolStripDropDown)
 
                    {
 
                        base.OnRenderToolStripBackground(e);
 
                    }
 
                    else
 
                    {
 
                        using (SolidBrush outerBrush = new SolidBrush(ColorTable.ToolStripGradientEnd))
 
                        {
 
                            e.Graphics.FillRectangle(outerBrush, backgroundRectangle);
 
                        }
 
 
                        int y2 = backgroundRectangle.Height / 2;
 
                        Rectangle upperRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Y, backgroundRectangle.Width, y2);
 
 
                        using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush(
 
                            upperRectangle,
 
                            ColorTable.ToolStripGradientBegin,
 
                            ColorTable.ToolStripGradientMiddle,
 
                            LinearGradientMode.Vertical))
 
                        {
 
                            e.Graphics.FillRectangle(innerRectangleBrush, upperRectangle); //draw top bubble
 
                        }
 
 
                        y2 = backgroundRectangle.Height / 4; 
 
                        Rectangle lowerRectangle = new Rectangle(backgroundRectangle.X, backgroundRectangle.Height - y2, backgroundRectangle.Width, y2);
 
 
                        using (LinearGradientBrush innerRectangleBrush = new LinearGradientBrush(
 
                            lowerRectangle,
 
                            ColorTable.ToolStripGradientEnd,
 
                            ColorTable.ToolStripGradientMiddle,
 
                            LinearGradientMode.Vertical))
 
                        {
 
                            e.Graphics.FillRectangle(innerRectangleBrush, lowerRectangle); //draw top bubble
 
                        }
 
                    }
 
                }
 
            }
 
        }
 
        /// <summary>
 
        /// Raises the RenderImageMargin event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == true)
 
			{
 
				base.OnRenderToolStripBackground(e);
 
			}
 
			else
 
			{
 
				if ((e.ToolStrip is ContextMenuStrip) ||
 
					(e.ToolStrip is ToolStripDropDownMenu))
 
				{
 
					// Start with the total margin area
 
					Rectangle marginRectangle = e.AffectedBounds;
 
 
					// Do we need to draw with separator on the opposite edge?
 
					bool bIsRightToLeft = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
 
 
					marginRectangle.Y += MarginInset;
 
					marginRectangle.Height -= MarginInset * 2;
 
 
					// Reduce so it is inside the border
 
					if (bIsRightToLeft == false)
 
					{
 
						marginRectangle.X += MarginInset;
 
					}
 
					else
 
					{
 
						marginRectangle.X += MarginInset / 2;
 
					}
 
 
					// Draw the entire margine area in a solid color
 
					using (SolidBrush backBrush = new SolidBrush(
 
						ColorTable.ImageMarginGradientBegin))
 
						e.Graphics.FillRectangle(backBrush, marginRectangle);
 
				}
 
				else
 
				{
 
					base.OnRenderImageMargin(e);
 
				}
 
			}
 
        }
 
 
		#endregion
 
 
		#region MethodsPrivate
 
        private static GraphicsPath GetBackgroundPath(Rectangle bounds, int radius)
 
        {
 
            int x = bounds.X;
 
            int y = bounds.Y;
 
            int width = bounds.Width;
 
            int height = bounds.Height;
 
            GraphicsPath graphicsPath = new GraphicsPath();
 
            graphicsPath.AddArc(x, y, radius, radius, 180, 90);				                    //Upper left corner
 
            graphicsPath.AddArc(x + width - radius, y, radius, radius, 270, 90);			    //Upper right corner
 
            graphicsPath.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);//Lower right corner
 
            graphicsPath.AddArc(x, y + height - radius, radius, radius, 90, 90);			    //Lower left corner
 
            graphicsPath.CloseFigure();
 
            return graphicsPath;
 
        }
 
 
        private static void RenderButton(Graphics graphics, Rectangle buttonBounds, Color gradientColor)
 
        {
 
            using (GraphicsPath graphicsPath = GetBackgroundPath(buttonBounds, 3))
 
            {
 
                using (LinearGradientBrush backBrush = new LinearGradientBrush(buttonBounds,
 
                    gradientColor,
 
                    Color.Transparent,
 
                    LinearGradientMode.Vertical))
 
                {
 
                    backBrush.Blend = ButtonBlend;
 
                    graphics.FillPath(backBrush, graphicsPath);
 
                }
 
            }
 
        }
 
 
        private static void RenderMenuItem(Graphics graphics, Rectangle menuBounds, Color gradientColor)
 
        {
 
            using (LinearGradientBrush backBrush = new LinearGradientBrush(
 
                menuBounds,
 
                gradientColor,
 
                Color.Transparent,
 
                LinearGradientMode.Vertical))
 
            {
 
                backBrush.Blend = MenuItemBlend;
 
                graphics.FillRectangle(backBrush, menuBounds);
 
            }
 
        }
 
 
        private static void DrawButtonBorder(Graphics graphics, Rectangle buttonBounds, Color borderColor)
 
        {
 
            using (GraphicsPath itemPath = GetBackgroundPath(buttonBounds, 3))
 
            {
 
                using (Pen itemPen = new Pen(borderColor))
 
                {
 
                    graphics.DrawPath(itemPen, itemPath);
 
                }
 
            }
 
        }
 
 
        private static void DrawInnerButtonBorder(Graphics graphics, Rectangle buttonBounds, Color innerBorderColor)
 
        {
 
            Rectangle innerButtonRectangle = buttonBounds;
 
            innerButtonRectangle.Height -= 1;
 
            innerButtonRectangle.Width -= 1;
 
            using (GraphicsPath innerBorderPath = GetBackgroundPath(innerButtonRectangle, 3))
 
            {
 
                using (Pen itemPen = new Pen(innerBorderColor))
 
                {
 
                    graphics.DrawPath(itemPen, innerBorderPath);
 
                }
 
            }
 
        }
 
 
        private static Rectangle GetButtonRectangle(Rectangle bounds)
 
        {
 
            Rectangle buttonRectangle = bounds;
 
            buttonRectangle.Width -= 1;
 
            buttonRectangle.Height -= 1;
 
            buttonRectangle.Inflate(0, -1);
 
            return buttonRectangle;
 
        }
 
        /// <summary>
 
        /// Renders the arrows in the OverflowButton.
 
        /// </summary>
 
        /// <param name="graphics">The Graphics to draw on.</param>
 
        /// <param name="dropDownRectangle">The rectangle in which the arrows should drawn.</param>
 
        /// <param name="direction">the direction of the arrows.</param>
 
        /// <param name="color">The color used to fill the arrow polygons</param>
 
        private static void RenderArrowInternal(Graphics graphics, Rectangle dropDownRectangle, ArrowDirection direction, Color color)
 
        {
 
            Point point = new Point(dropDownRectangle.Left + (dropDownRectangle.Width / 2), dropDownRectangle.Top + (dropDownRectangle.Height / 2));
 
            point.X += dropDownRectangle.Width % 2;
 
            Point[] points = null;
 
            switch (direction)
 
            {
 
                case ArrowDirection.Left:
 
                    points = new Point[] { new Point(point.X + 2, point.Y - 3), new Point(point.X + 2, point.Y + 3), new Point(point.X - 1, point.Y) };
 
                    break;
 
 
                case ArrowDirection.Up:
 
                    points = new Point[] { new Point(point.X - 2, point.Y + 1), new Point(point.X + 3, point.Y + 1), new Point(point.X, point.Y - 2) };
 
                    break;
 
 
                case ArrowDirection.Right:
 
                    points = new Point[] { new Point(point.X - 2, point.Y - 3), new Point(point.X - 2, point.Y + 3), new Point(point.X + 1, point.Y) };
 
                    break;
 
 
                default:
 
                    points = new Point[] { new Point(point.X - 2, point.Y - 1), new Point(point.X + 3, point.Y - 1), new Point(point.X, point.Y + 2) };
 
                    break;
 
            }
 
            using (SolidBrush backBrush = new SolidBrush(color))
 
            {
 
                graphics.FillPolygon(backBrush, points);
 
            }
 
        }
 
        /// <summary>
 
        /// Renders the lines in the OverflowButton.
 
        /// </summary>
 
        /// <param name="graphics">The Graphics to draw on.</param>
 
        /// <param name="color">The color used to fill the line</param>
 
        /// <param name="x1">The x-coordinate of the first point.</param>
 
        /// <param name="y1">The y-coordinate of the first point.</param>
 
        /// <param name="x2">The x-coordinate of the second point.</param>
 
        /// <param name="y2">The y-coordinate of the second point.</param>
 
        private static void RenderOverflowButtonLine(Graphics graphics,Color color, int x1, int y1, int x2, int y2)
 
        {
 
            using (Pen pen = new Pen(color))
 
            {
 
                graphics.DrawLine(pen, x1, y1, x2, y2);
 
            }
 
        }
 
        /// <summary>
 
        /// Checks if the rectangle width or height is equal to 0.
 
        /// </summary>
 
        /// <param name="rectangle">the rectangle to check</param>
 
        /// <returns>true if the with or height of the rectangle is 0 else false</returns>
 
        private static bool IsZeroWidthOrHeight(Rectangle rectangle)
 
        {
 
            if (rectangle.Width != 0)
 
            {
 
                return (rectangle.Height == 0);
 
            }
 
            return true;
 
        }
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/ColorTableBlack.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Collections.Generic;
 
using System.Windows.Forms;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provide Office 2007 black theme colors
 
    /// </summary>
 
    public class ColorTableBlack : BSE.Windows.Forms.BseColorTable
 
    {
 
        #region FieldsPrivate
 
        private PanelColors m_panelColorTable;
 
        #endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets the associated ColorTable for the XPanderControls
 
        /// </summary>
 
        public override PanelColors PanelColorTable
 
        {
 
            get
 
            {
 
                if (this.m_panelColorTable == null)
 
                {
 
                    this.m_panelColorTable = new PanelColorsBlack();
 
                }
 
                return this.m_panelColorTable;
 
            }
 
        }
 
        #endregion
 
        
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Initializes a color dictionary with defined colors
 
        /// </summary>
 
        /// <param name="rgbTable">Dictionary with defined colors</param>
 
        protected override void InitColors(Dictionary<ProfessionalColorTable.KnownColors, Color> rgbTable)
 
        {
 
            base.InitColors(rgbTable);
 
            rgbTable[KnownColors.ButtonPressedBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(141, 170, 253);
 
            rgbTable[KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(98, 101, 252);
 
            rgbTable[KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(43, 93, 255);
 
            rgbTable[KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(106, 109, 228);
 
            rgbTable[KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(88, 111, 226);
 
            rgbTable[KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(39, 39, 217);
 
			rgbTable[KnownColors.ButtonSelectedHighlightBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.GripDark] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.GripLight] = Color.FromArgb(182, 182, 182);
 
            rgbTable[KnownColors.ImageMarginGradientBegin] = Color.FromArgb(239, 239, 239);
 
            rgbTable[KnownColors.MenuBorder] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.MenuItemSelectedGradientBegin] = Color.FromArgb(231, 239, 243);
 
            rgbTable[KnownColors.MenuItemSelectedGradientEnd] = Color.FromArgb(218, 235, 243);
 
            rgbTable[KnownColors.MenuItemText] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedGradientBegin] = Color.FromArgb(205, 208, 213);
 
            rgbTable[KnownColors.MenuStripGradientBegin] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.MenuStripGradientEnd] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(136, 144, 254);
 
            rgbTable[KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(111, 145, 255);
 
            rgbTable[KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(42, 52, 254);
 
            rgbTable[KnownColors.RaftingContainerGradientBegin] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.RaftingContainerGradientEnd] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.SeparatorDark] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.SeparatorLight] = Color.FromArgb(182, 182, 182);
 
            rgbTable[KnownColors.StatusStripGradientBegin] = Color.FromArgb(100, 100, 100);
 
            rgbTable[KnownColors.StatusStripGradientEnd] = Color.FromArgb(0, 0, 0);
 
			rgbTable[KnownColors.StatusStripText] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.ToolStripBorder] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientBegin] = Color.FromArgb(42, 42, 42);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientEnd] = Color.FromArgb(10, 10, 10);
 
            rgbTable[KnownColors.ToolStripDropDownBackground] = Color.FromArgb(250, 250, 250);
 
            rgbTable[KnownColors.ToolStripGradientBegin] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.ToolStripGradientEnd] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.ToolStripGradientMiddle] = Color.FromArgb(52, 52, 52);
 
            rgbTable[KnownColors.ToolStripPanelGradientBegin] = Color.FromArgb(12, 12, 12);
 
            rgbTable[KnownColors.ToolStripPanelGradientEnd] = Color.FromArgb(2, 2, 2);
 
            rgbTable[KnownColors.ToolStripText] = Color.FromArgb(255, 255, 255);
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/ColorTableBlue.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Collections.Generic;
 
using System.Windows.Forms;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provide Office 2007 black theme colors
 
    /// </summary>
 
    public class ColorTableBlue : BSE.Windows.Forms.BseColorTable
 
    {
 
        #region FieldsPrivate
 
        private PanelColors m_panelColorTable;
 
        #endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets the associated ColorTable for the XPanderControls
 
        /// </summary>
 
        public override PanelColors PanelColorTable
 
        {
 
            get
 
            {
 
                if (this.m_panelColorTable == null)
 
                {
 
                    this.m_panelColorTable = new PanelColorsBlue();
 
                }
 
                return this.m_panelColorTable;
 
            }
 
        }
 
        #endregion
 
        
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Initializes a color dictionary with defined colors
 
        /// </summary>
 
        /// <param name="rgbTable">Dictionary with defined colors</param>
 
        protected override void InitColors(Dictionary<ProfessionalColorTable.KnownColors, Color> rgbTable)
 
        {
 
            base.InitColors(rgbTable);
 
            rgbTable[KnownColors.ButtonPressedBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(141, 170, 253);
 
            rgbTable[KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(98, 101, 252);
 
            rgbTable[KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(43, 93, 255);
 
            rgbTable[KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(188, 205, 254);
 
            rgbTable[KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(153, 155, 253);
 
            rgbTable[KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(111, 145, 255);
 
			rgbTable[KnownColors.ButtonSelectedHighlightBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.GripDark] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.GripLight] = Color.FromArgb(182, 182, 182);
 
            rgbTable[KnownColors.ImageMarginGradientBegin] = Color.FromArgb(239, 239, 239);
 
            rgbTable[KnownColors.MenuBorder] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.MenuItemSelectedGradientBegin] = Color.FromArgb(231, 239, 243);
 
            rgbTable[KnownColors.MenuItemSelectedGradientEnd] = Color.FromArgb(218, 235, 243);
 
            rgbTable[KnownColors.MenuItemText] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedGradientBegin] = Color.FromArgb(205, 208, 213);
 
            rgbTable[KnownColors.MenuStripGradientBegin] = Color.FromArgb(128, 128, 255);
 
            rgbTable[KnownColors.MenuStripGradientEnd] = Color.FromArgb(0, 0, 128);
 
            rgbTable[KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(166, 189, 254);
 
            rgbTable[KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(119, 123, 253);
 
            rgbTable[KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(63, 108, 253);
 
            rgbTable[KnownColors.RaftingContainerGradientBegin] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.RaftingContainerGradientEnd] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.SeparatorDark] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.SeparatorLight] = Color.FromArgb(182, 182, 182);
 
            rgbTable[KnownColors.StatusStripGradientBegin] = Color.FromArgb(128, 128, 255);
 
            rgbTable[KnownColors.StatusStripGradientEnd] = Color.FromArgb(0, 0, 128);
 
			rgbTable[KnownColors.StatusStripText] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.ToolStripBorder] = Color.FromArgb(102, 102, 102);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientBegin] = Color.FromArgb(0, 0, 139);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientEnd] = Color.FromArgb(0, 0, 128);
 
            rgbTable[KnownColors.ToolStripDropDownBackground] = Color.FromArgb(250, 250, 250);
 
            rgbTable[KnownColors.ToolStripGradientBegin] = Color.FromArgb(128, 128, 255);
 
            rgbTable[KnownColors.ToolStripGradientEnd] = Color.FromArgb(0, 0, 139);
 
            rgbTable[KnownColors.ToolStripGradientMiddle] = Color.FromArgb(0, 0, 128);
 
            rgbTable[KnownColors.ToolStripPanelGradientBegin] = Color.FromArgb(0, 0, 128);
 
            rgbTable[KnownColors.ToolStripPanelGradientEnd] = Color.FromArgb(0, 0, 128);
 
            rgbTable[KnownColors.ToolStripText] = Color.FromArgb(255, 255, 255);
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/Office2007BlackColorTable.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Collections.Generic;
 
using System.Windows.Forms;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provides colors used for Microsoft Office 2007 black display elements.
 
    /// </summary>
 
    public class Office2007BlackColorTable : BSE.Windows.Forms.OfficeColorTable
 
	{
 
		#region FieldsPrivate
 
        private PanelColors m_panelColorTable;
 
		#endregion
 
 
		#region Properties
 
        /// <summary>
 
        /// Gets the associated ColorTable for the XPanderControls
 
        /// </summary>
 
        public override PanelColors PanelColorTable
 
        {
 
            get
 
            {
 
                if (this.m_panelColorTable == null)
 
                {
 
                    this.m_panelColorTable = new PanelColorsOffice2007Black();
 
                }
 
                return this.m_panelColorTable;
 
            }
 
        }
 
		#endregion
 
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Initializes a color dictionary with defined colors.
 
        /// </summary>
 
        /// <param name="rgbTable">Dictionary with defined colors</param>
 
        protected override void InitColors(Dictionary<ProfessionalColorTable.KnownColors, Color> rgbTable)
 
        {
 
            rgbTable[KnownColors.ButtonPressedBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(248, 181, 106);
 
            rgbTable[KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(255, 208, 134);
 
            rgbTable[KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(251, 140, 60);
 
            rgbTable[KnownColors.ButtonSelectedBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(255, 245, 204);
 
            rgbTable[KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(255, 219, 117);
 
            rgbTable[KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(255, 231, 162);
 
			rgbTable[KnownColors.ButtonSelectedHighlightBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.CheckBackground] = Color.FromArgb(255, 227, 149);
 
			rgbTable[KnownColors.CheckSelectedBackground] = Color.FromArgb(254, 128, 62);
 
            rgbTable[KnownColors.GripDark] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.GripLight] = Color.FromArgb(221, 224, 227);
 
            rgbTable[KnownColors.ImageMarginGradientBegin] = Color.FromArgb(239, 239, 239);
 
            rgbTable[KnownColors.MenuBorder] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.MenuItemBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.MenuItemPressedGradientBegin] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.MenuItemPressedGradientEnd] = Color.FromArgb(108, 117, 128);
 
            rgbTable[KnownColors.MenuItemPressedGradientMiddle] = Color.FromArgb(126, 135, 146);
 
			rgbTable[KnownColors.MenuItemSelected] = Color.FromArgb(255, 238, 194);
 
			rgbTable[KnownColors.MenuItemSelectedGradientBegin] = Color.FromArgb(255, 245, 204);
 
            rgbTable[KnownColors.MenuItemSelectedGradientEnd] = Color.FromArgb(255, 223, 132);
 
            rgbTable[KnownColors.MenuItemText] = Color.FromArgb(255, 255, 255);
 
			rgbTable[KnownColors.MenuStripGradientBegin] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.MenuStripGradientEnd] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(178, 183, 191);
 
            rgbTable[KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(81, 88, 98);
 
            rgbTable[KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.RaftingContainerGradientBegin] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.RaftingContainerGradientEnd] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.SeparatorDark] = Color.FromArgb(145, 153, 164);
 
            rgbTable[KnownColors.SeparatorLight] = Color.FromArgb(221, 224, 227);
 
            rgbTable[KnownColors.StatusStripGradientBegin] = Color.FromArgb(76, 83, 92);
 
            rgbTable[KnownColors.StatusStripGradientEnd] = Color.FromArgb(35, 38, 42);
 
			rgbTable[KnownColors.StatusStripText] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.ToolStripBorder] = Color.FromArgb(76, 83, 92);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientBegin] = Color.FromArgb(82, 82, 82);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientEnd] = Color.FromArgb(10, 10, 10);
 
            rgbTable[KnownColors.ToolStripDropDownBackground] = Color.FromArgb(250, 250, 250);
 
            rgbTable[KnownColors.ToolStripGradientBegin] = Color.FromArgb(205, 208, 213);
 
            rgbTable[KnownColors.ToolStripGradientEnd] = Color.FromArgb(148, 156, 166);
 
            rgbTable[KnownColors.ToolStripGradientMiddle] = Color.FromArgb(188, 193, 200);
 
            rgbTable[KnownColors.ToolStripPanelGradientBegin] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.ToolStripPanelGradientEnd] = Color.FromArgb(83, 83, 83);
 
            rgbTable[KnownColors.ToolStripText] = Color.FromArgb(0, 0, 0);
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/Office2007BlueColorTable.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Collections.Generic;
 
using System.Windows.Forms;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provides colors used for Microsoft Office 2007 blue display elements.
 
    /// </summary>
 
    public class Office2007BlueColorTable : BSE.Windows.Forms.OfficeColorTable
 
	{
 
		#region FieldsPrivate
 
        private PanelColors m_panelColorTable;
 
        #endregion
 
 
		#region Properties
 
        /// <summary>
 
        /// Gets the associated ColorTable for the XPanderControls
 
        /// </summary>
 
        public override PanelColors PanelColorTable
 
        {
 
            get
 
            {
 
                if (this.m_panelColorTable == null)
 
                {
 
                    this.m_panelColorTable = new PanelColorsOffice2007Blue();
 
                }
 
                return this.m_panelColorTable;
 
            }
 
        }
 
		#endregion
 
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Unitializes a color dictionary with defined colors
 
        /// </summary>
 
        /// <param name="rgbTable">Dictionary with defined colors</param>
 
        protected override void InitColors(Dictionary<ProfessionalColorTable.KnownColors, Color> rgbTable)
 
        {
 
            rgbTable[KnownColors.ButtonPressedBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(248, 181, 106);
 
            rgbTable[KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(255, 208, 134);
 
            rgbTable[KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(251, 140, 60);
 
            rgbTable[KnownColors.ButtonSelectedBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(255, 245, 204);
 
            rgbTable[KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(255, 219, 117);
 
            rgbTable[KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(255, 231, 162);
 
			rgbTable[KnownColors.ButtonSelectedHighlightBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.CheckBackground] = Color.FromArgb(255, 227, 149);
 
			rgbTable[KnownColors.CheckSelectedBackground] = Color.FromArgb(254, 128, 62);
 
            rgbTable[KnownColors.GripDark] = Color.FromArgb(111, 157, 217);
 
            rgbTable[KnownColors.GripLight] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.ImageMarginGradientBegin] = Color.FromArgb(233, 238, 238);
 
            rgbTable[KnownColors.MenuBorder] = Color.FromArgb(134, 134, 134);
 
            rgbTable[KnownColors.MenuItemBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.MenuItemPressedGradientBegin] = Color.FromArgb(227, 239, 255);
 
            rgbTable[KnownColors.MenuItemPressedGradientEnd] = Color.FromArgb(152, 186, 230);
 
            rgbTable[KnownColors.MenuItemPressedGradientMiddle] = Color.FromArgb(222, 236, 255);
 
			rgbTable[KnownColors.MenuItemSelected] = Color.FromArgb(255, 238, 194);
 
			rgbTable[KnownColors.MenuItemSelectedGradientBegin] = Color.FromArgb(255, 245, 204);
 
            rgbTable[KnownColors.MenuItemSelectedGradientEnd] = Color.FromArgb(255, 223, 132);
 
			rgbTable[KnownColors.MenuItemText] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.MenuStripGradientBegin] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.MenuStripGradientEnd] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(167, 204, 251);
 
            rgbTable[KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(101, 147, 207);
 
            rgbTable[KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(167, 204, 251);
 
            rgbTable[KnownColors.RaftingContainerGradientBegin] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.RaftingContainerGradientEnd] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.SeparatorDark] = Color.FromArgb(173, 209, 255);
 
            rgbTable[KnownColors.SeparatorLight] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.StatusStripGradientBegin] = Color.FromArgb(227, 239, 255);
 
            rgbTable[KnownColors.StatusStripGradientEnd] = Color.FromArgb(173, 209, 255);
 
			rgbTable[KnownColors.StatusStripText] = Color.FromArgb(21, 66, 139);
 
            rgbTable[KnownColors.ToolStripBorder] = Color.FromArgb(111, 157, 217);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientBegin] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientEnd] = Color.FromArgb(101, 145, 205);
 
            rgbTable[KnownColors.ToolStripDropDownBackground] = Color.FromArgb(250, 250, 250);
 
            rgbTable[KnownColors.ToolStripGradientBegin] = Color.FromArgb(227, 239, 255);
 
            rgbTable[KnownColors.ToolStripGradientEnd] = Color.FromArgb(152, 186, 230);
 
            rgbTable[KnownColors.ToolStripGradientMiddle] = Color.FromArgb(222, 236, 255);
 
            rgbTable[KnownColors.ToolStripPanelGradientBegin] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.ToolStripPanelGradientEnd] = Color.FromArgb(191, 219, 255);
 
            rgbTable[KnownColors.ToolStripText] = Color.FromArgb(0, 0, 0);
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/Office2007Renderer.cs
Show inline comments
 
new file 100644
 
/********************************************************************/
 
/*  Office 2007 Renderer Project                                    */
 
/*                                                                  */
 
/*  Use the Office2007Renderer class as a custom renderer by        */
 
/*  providing it to the ToolStripManager.Renderer property. Then    */
 
/*  all tool strips, menu strips, status strips etc will be drawn   */
 
/*  using the Office 2007 style renderer in your application.       */
 
/*                                                                  */
 
/*   Author: Phil Wright                                            */
 
/*  Website: www.componentfactory.com                               */
 
/*  Contact: phil.wright@componentfactory.com                       */
 
/********************************************************************/
 
 
using System.Drawing;
 
using System.Drawing.Text;
 
using System.Drawing.Drawing2D;
 
using System.Windows.Forms;
 
using System.Collections.Generic;
 
using System.Diagnostics;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Draw ToolStrips using the Office 2007 themed appearance.
 
    /// </summary>
 
    public class Office2007Renderer : ToolStripProfessionalRenderer
 
    {
 
        #region FieldsPrivate
 
 
        private static int MarginInset;
 
        private static Blend StatusStripBlend;
 
 
        #endregion
 
 
		#region MethodsPublic
 
		static Office2007Renderer()
 
        {
 
            MarginInset = 2;
 
            // One time creation of the blend for the status strip gradient brush
 
            StatusStripBlend = new Blend();
 
            StatusStripBlend.Positions = new float[] { 0.0F, 0.2F, 0.3F, 0.4F, 0.8F, 1.0F };
 
            StatusStripBlend.Factors = new float[] { 0.3F, 0.4F, 0.5F, 1.0F, 0.8F, 0.7F };
 
        }
 
        /// <summary>
 
        /// Initialize a new instance of the Office2007Renderer class.
 
        /// </summary>
 
		public Office2007Renderer()
 
			: base(new BSE.Windows.Forms.Office2007BlueColorTable())
 
		{
 
			this.ColorTable.UseSystemColors = false;
 
		}
 
        /// <summary>
 
        /// Initializes a new instance of the Office2007Renderer class.
 
        /// </summary>
 
        /// <param name="professionalColorTable">A <see cref="ProfessionalColorTable"/> to be used for painting.</param>
 
        public Office2007Renderer(ProfessionalColorTable professionalColorTable)
 
            : base(professionalColorTable)
 
        {
 
        }
 
        #endregion
 
 
		#region MethodsProtected
 
        /// <summary>
 
        /// Raises the RenderArrow event.
 
        /// </summary>
 
        /// <param name="e">A ToolStripArrowRenderEventArgs that contains the event data.</param>
 
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				ProfessionalColorTable colorTable = ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
 
				if (colorTable != null)
 
				{
 
					if ((e.Item.Owner.GetType() == typeof(MenuStrip)) && (e.Item.Selected == false) && e.Item.Pressed == false)
 
					{
 
						if (colorTable.MenuItemText != Color.Empty)
 
						{
 
							e.ArrowColor = colorTable.MenuItemText;
 
						}
 
					}
 
					if ((e.Item.Owner.GetType() == typeof(StatusStrip)) && (e.Item.Selected == false) && e.Item.Pressed == false)
 
					{
 
						if (colorTable.StatusStripText != Color.Empty)
 
						{
 
							e.ArrowColor = colorTable.StatusStripText;
 
						}
 
					}
 
				}
 
			}
 
            base.OnRenderArrow(e);
 
        }
 
        /// <summary>
 
        /// Raises the RenderItemText event.
 
        /// </summary>
 
        /// <param name="e">A ToolStripItemTextRenderEventArgs that contains the event data.</param>
 
        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				ProfessionalColorTable colorTable = ColorTable as BSE.Windows.Forms.ProfessionalColorTable;
 
				if (colorTable != null)
 
				{
 
					if ((e.ToolStrip is MenuStrip) && (e.Item.Selected == false) && e.Item.Pressed == false)
 
					{
 
						if (colorTable.MenuItemText != Color.Empty)
 
						{
 
							e.TextColor = colorTable.MenuItemText;
 
						}
 
					}
 
					if ((e.ToolStrip is StatusStrip) && (e.Item.Selected == false) && e.Item.Pressed == false)
 
					{
 
						if (colorTable.StatusStripText != Color.Empty)
 
						{
 
							e.TextColor = colorTable.StatusStripText;
 
						}
 
					}
 
				}
 
			}
 
            base.OnRenderItemText(e);
 
        }
 
        /// <summary>
 
        /// Raises the RenderToolStripContentPanelBackground event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripContentPanelRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
 
        {
 
            // Must call base class, otherwise the subsequent drawing does not appear!
 
            base.OnRenderToolStripContentPanelBackground(e);
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				// Cannot paint a zero sized area
 
				if ((e.ToolStripContentPanel.Width > 0) &&
 
					(e.ToolStripContentPanel.Height > 0))
 
				{
 
					using (LinearGradientBrush backBrush = new LinearGradientBrush(e.ToolStripContentPanel.ClientRectangle,
 
																				   ColorTable.ToolStripContentPanelGradientBegin,
 
																				   ColorTable.ToolStripContentPanelGradientEnd,
 
																				   LinearGradientMode.Vertical))
 
					{
 
						e.Graphics.FillRectangle(backBrush, e.ToolStripContentPanel.ClientRectangle);
 
					}
 
				}
 
			}
 
        }
 
        /// <summary>
 
        /// Raises the RenderSeparator event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripSeparatorRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == false)
 
			{
 
				e.Item.ForeColor = ColorTable.RaftingContainerGradientBegin;
 
			}
 
            base.OnRenderSeparator(e);
 
        }
 
        /// <summary>
 
        /// Raises the RenderToolStripBackground event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == true)
 
			{
 
				base.OnRenderToolStripBackground(e);
 
			}
 
			else
 
			{
 
				if (e.ToolStrip is StatusStrip)
 
				{
 
					// We do not paint the top two pixel lines, so are drawn by the status strip border render method
 
					//RectangleF backRectangle = new RectangleF(0, 1.5f, e.ToolStrip.Width, e.ToolStrip.Height - 2);
 
					RectangleF backRectangle = new RectangleF(0, 0, e.ToolStrip.Width, e.ToolStrip.Height);
 
 
					// Cannot paint a zero sized area
 
					if ((backRectangle.Width > 0) && (backRectangle.Height > 0))
 
					{
 
						using (LinearGradientBrush backBrush = new LinearGradientBrush(backRectangle,
 
																					   ColorTable.StatusStripGradientBegin,
 
																					   ColorTable.StatusStripGradientEnd,
 
																					   LinearGradientMode.Vertical))
 
						{
 
							backBrush.Blend = StatusStripBlend;
 
							e.Graphics.FillRectangle(backBrush, backRectangle);
 
						}
 
					}
 
				}
 
				else
 
				{
 
					base.OnRenderToolStripBackground(e);
 
				}
 
			}
 
        }
 
        /// <summary>
 
        /// Raises the RenderImageMargin event. 
 
        /// </summary>
 
        /// <param name="e">An ToolStripRenderEventArgs containing the event data.</param>
 
        protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
 
        {
 
			if (ColorTable.UseSystemColors == true)
 
			{
 
				base.OnRenderToolStripBackground(e);
 
			}
 
			else
 
			{
 
				if ((e.ToolStrip is ContextMenuStrip) ||
 
					(e.ToolStrip is ToolStripDropDownMenu))
 
				{
 
					// Start with the total margin area
 
					Rectangle marginRectangle = e.AffectedBounds;
 
 
					// Do we need to draw with separator on the opposite edge?
 
					bool bIsRightToLeft = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
 
 
					marginRectangle.Y += MarginInset;
 
					marginRectangle.Height -= MarginInset * 2;
 
 
					// Reduce so it is inside the border
 
					if (bIsRightToLeft == false)
 
					{
 
						marginRectangle.X += MarginInset;
 
					}
 
					else
 
					{
 
						marginRectangle.X += MarginInset / 2;
 
					}
 
 
					// Draw the entire margine area in a solid color
 
					using (SolidBrush backBrush = new SolidBrush(
 
						ColorTable.ImageMarginGradientBegin))
 
						e.Graphics.FillRectangle(backBrush, marginRectangle);
 
				}
 
				else
 
				{
 
					base.OnRenderImageMargin(e);
 
				}
 
			}
 
        }
 
 
		#endregion
 
 
		#region MethodsPrivate
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/Office2007SilverColorTable.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Collections.Generic;
 
using System.Windows.Forms;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provides colors used for Microsoft Office 2007 silver display elements.
 
    /// </summary>
 
    public class Office2007SilverColorTable : BSE.Windows.Forms.OfficeColorTable
 
	{
 
        #region FieldsPrivate
 
        private PanelColors m_panelColorTable;
 
        #endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets the associated ColorTable for the XPanderControls
 
        /// </summary>
 
        public override PanelColors PanelColorTable
 
        {
 
            get
 
            {
 
                if (this.m_panelColorTable == null)
 
                {
 
                    this.m_panelColorTable = new PanelColorsOffice2007Silver();
 
                }
 
                return this.m_panelColorTable;
 
            }
 
        }
 
        #endregion
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Initializes a color dictionary with defined colors
 
        /// </summary>
 
        /// <param name="rgbTable">Dictionary with defined colors</param>
 
        protected override void InitColors(Dictionary<ProfessionalColorTable.KnownColors, Color> rgbTable)
 
        {
 
            rgbTable[KnownColors.ButtonPressedBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(248, 181, 106);
 
            rgbTable[KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(255, 208, 134);
 
            rgbTable[KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(251, 140, 60);
 
            rgbTable[KnownColors.ButtonSelectedBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(255, 245, 204);
 
            rgbTable[KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(255, 219, 117);
 
            rgbTable[KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(255, 232, 116);
 
			rgbTable[KnownColors.ButtonSelectedHighlightBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.CheckBackground] = Color.FromArgb(255, 227, 149);
 
			rgbTable[KnownColors.CheckSelectedBackground] = Color.FromArgb(254, 128, 62);
 
            rgbTable[KnownColors.GripDark] = Color.FromArgb(84, 84, 117);
 
            rgbTable[KnownColors.GripLight] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.ImageMarginGradientBegin] = Color.FromArgb(239, 239, 239);
 
            rgbTable[KnownColors.MenuBorder] = Color.FromArgb(124, 124, 148);
 
            rgbTable[KnownColors.MenuItemBorder] = Color.FromArgb(255, 189, 105);
 
            rgbTable[KnownColors.MenuItemPressedGradientBegin] = Color.FromArgb(232, 233, 241);
 
            rgbTable[KnownColors.MenuItemPressedGradientEnd] = Color.FromArgb(186, 185, 205);
 
            rgbTable[KnownColors.MenuItemPressedGradientMiddle] = Color.FromArgb(209, 209, 223);
 
			rgbTable[KnownColors.MenuItemSelected] = Color.FromArgb(255, 238, 194);
 
			rgbTable[KnownColors.MenuItemSelectedGradientBegin] = Color.FromArgb(255, 245, 204);
 
            rgbTable[KnownColors.MenuItemSelectedGradientEnd] = Color.FromArgb(255, 223, 132);
 
			rgbTable[KnownColors.MenuItemText] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.MenuStripGradientBegin] = Color.FromArgb(215, 215, 229);
 
            rgbTable[KnownColors.MenuStripGradientEnd] = Color.FromArgb(243, 243, 247);
 
            rgbTable[KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(179, 178, 200);
 
            rgbTable[KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(118, 116, 146);
 
            rgbTable[KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(152, 151, 177);
 
            rgbTable[KnownColors.RaftingContainerGradientBegin] = Color.FromArgb(215, 215, 229);
 
            rgbTable[KnownColors.RaftingContainerGradientEnd] = Color.FromArgb(243, 243, 247);
 
            rgbTable[KnownColors.SeparatorDark] = Color.FromArgb(110, 109, 143);
 
            rgbTable[KnownColors.SeparatorLight] = Color.FromArgb(255, 255, 255);
 
            rgbTable[KnownColors.StatusStripGradientBegin] = Color.FromArgb(235, 238, 250);
 
            rgbTable[KnownColors.StatusStripGradientEnd] = Color.FromArgb(197, 199, 209);
 
			rgbTable[KnownColors.StatusStripText] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.ToolStripBorder] = Color.FromArgb(124, 124, 148);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientBegin] = Color.FromArgb(207, 211, 220);
 
            rgbTable[KnownColors.ToolStripContentPanelGradientEnd] = Color.FromArgb(155, 159, 166);
 
            rgbTable[KnownColors.ToolStripDropDownBackground] = Color.FromArgb(250, 250, 250);
 
            rgbTable[KnownColors.ToolStripGradientBegin] = Color.FromArgb(243, 244, 250);
 
            rgbTable[KnownColors.ToolStripGradientEnd] = Color.FromArgb(153, 151, 181);
 
            rgbTable[KnownColors.ToolStripGradientMiddle] = Color.FromArgb(218, 219, 231);
 
            rgbTable[KnownColors.ToolStripPanelGradientBegin] = Color.FromArgb(215, 215, 229);
 
            rgbTable[KnownColors.ToolStripPanelGradientEnd] = Color.FromArgb(243, 243, 247);
 
            rgbTable[KnownColors.ToolStripText] = Color.FromArgb(0, 0, 0);
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/OfficeColorTable.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Baseclass for a colortable for the <see cref="Office2007Renderer"/>
 
    /// </summary>
 
    public class OfficeColorTable : BSE.Windows.Forms.ProfessionalColorTable
 
    {
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Renderer/ProfessionalColorTable.cs
Show inline comments
 
new file 100644
 
using System.Drawing;
 
using System.Windows.Forms;
 
using System.Collections.Generic;
 
using System.Runtime.InteropServices;
 
using System.Text;
 
using System.Windows.Forms.VisualStyles;
 
using System;
 
using Microsoft.Win32;
 
using System.IO;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provides colors used for Microsoft Office display elements.
 
    /// </summary>
 
    public class ProfessionalColorTable : System.Windows.Forms.ProfessionalColorTable
 
    {
 
        #region Enums
 
        /// <summary>
 
        /// Gets or sets the KnownColors appearance of the ProfessionalColorTable.
 
        /// </summary>
 
        public enum KnownColors
 
        {
 
            /// <summary>
 
            /// The border color to use with the <see cref="ButtonPressedGradientBegin"/>, <see cref="ButtonPressedGradientMiddle"/>, and <see cref="ButtonPressedGradientEnd"/> colors.
 
            /// </summary>
 
            ButtonPressedBorder,
 
            /// <summary>
 
            /// The starting color of the gradient used when the button is pressed down.
 
            /// </summary>
 
            ButtonPressedGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used when the button is pressed down.
 
            /// </summary>
 
            ButtonPressedGradientEnd,
 
            /// <summary>
 
            /// The middle color of the gradient used when the button is pressed down.
 
            /// </summary>
 
            ButtonPressedGradientMiddle,
 
            /// <summary>
 
            /// The starting color of the gradient used when the button is selected.
 
            /// </summary>
 
            ButtonSelectedGradientBegin,
 
            /// <summary>
 
            /// The border color to use with the ButtonSelectedGradientBegin,
 
            /// ButtonSelectedGradientMiddle,
 
            /// and ButtonSelectedGradientEnd colors.
 
            /// </summary>
 
            ButtonSelectedBorder,
 
            /// <summary>
 
            /// The end color of the gradient used when the button is selected.
 
            /// </summary>
 
            ButtonSelectedGradientEnd,
 
            /// <summary>
 
            /// The middle color of the gradient used when the button is selected.
 
            /// </summary>
 
            ButtonSelectedGradientMiddle,
 
			/// <summary>
 
            /// The border color to use with ButtonSelectedHighlight.
 
			/// </summary>
 
            ButtonSelectedHighlightBorder,
 
            /// <summary>
 
            /// The solid color to use when the check box is selected and gradients are being used.
 
            /// </summary>
 
            CheckBackground,
 
            /// <summary>
 
            /// The solid color to use when the check box is selected and gradients are being used.
 
            /// </summary>
 
			CheckSelectedBackground,
 
            /// <summary>
 
            /// The color to use for shadow effects on the grip or move handle.
 
            /// </summary>
 
            GripDark,
 
            /// <summary>
 
            /// The color to use for highlight effects on the grip or move handle.
 
            /// </summary>
 
            GripLight,
 
            /// <summary>
 
            /// The starting color of the gradient used in the image margin
 
            /// of a ToolStripDropDownMenu.
 
            /// </summary>
 
            ImageMarginGradientBegin,
 
            /// <summary>
 
            /// The border color or a MenuStrip.
 
            /// </summary>
 
            MenuBorder,
 
            /// <summary>
 
            /// The border color to use with a ToolStripMenuItem.
 
            /// </summary>
 
            MenuItemBorder,
 
            /// <summary>
 
            /// The starting color of the gradient used when a top-level
 
            /// ToolStripMenuItem is pressed down.
 
            /// </summary>
 
            MenuItemPressedGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used when a top-level
 
            /// ToolStripMenuItem is pressed down.
 
            /// </summary>
 
            MenuItemPressedGradientEnd,
 
            /// <summary>
 
            /// The middle color of the gradient used when a top-level
 
            /// ToolStripMenuItem is pressed down.
 
            /// </summary>
 
            MenuItemPressedGradientMiddle,
 
            /// <summary>
 
            /// The solid color to use when a ToolStripMenuItem other
 
            /// than the top-level ToolStripMenuItem is selected.
 
            /// </summary>
 
			MenuItemSelected,
 
            /// <summary>
 
            /// The starting color of the gradient used when the ToolStripMenuItem is selected.
 
            /// </summary>
 
			MenuItemSelectedGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used when the ToolStripMenuItem is selected.
 
            /// </summary>
 
            MenuItemSelectedGradientEnd,
 
            /// <summary>
 
            /// The text color of a top-level ToolStripMenuItem.
 
            /// </summary>
 
            MenuItemText,
 
            /// <summary>
 
            /// The border color used when a top-level
 
            /// ToolStripMenuItem is selected.
 
            /// </summary>
 
            MenuItemTopLevelSelectedBorder,
 
            /// <summary>
 
            /// The starting color of the gradient used when a top-level
 
            /// ToolStripMenuItem is selected.
 
            /// </summary>
 
            MenuItemTopLevelSelectedGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used when a top-level
 
            /// ToolStripMenuItem is selected. 
 
            /// </summary>
 
            MenuItemTopLevelSelectedGradientEnd,
 
            /// <summary>
 
            /// The middle color of the gradient used when a top-level
 
            /// ToolStripMenuItem is selected.
 
            /// </summary>
 
            MenuItemTopLevelSelectedGradientMiddle,
 
            /// <summary>
 
            /// The starting color of the gradient used in the MenuStrip.
 
            /// </summary>
 
            MenuStripGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used in the MenuStrip.
 
            /// </summary>
 
            MenuStripGradientEnd,
 
            /// <summary>
 
            /// The starting color of the gradient used in the ToolStripOverflowButton.
 
            /// </summary>
 
            OverflowButtonGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used in the ToolStripOverflowButton.
 
            /// </summary>
 
            OverflowButtonGradientEnd,
 
            /// <summary>
 
            /// The middle color of the gradient used in the ToolStripOverflowButton.
 
            /// </summary>
 
            OverflowButtonGradientMiddle,
 
            /// <summary>
 
            /// The starting color of the gradient used in the ToolStripContainer.
 
            /// </summary>
 
            RaftingContainerGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used in the ToolStripContainer.
 
            /// </summary>
 
            RaftingContainerGradientEnd,
 
            /// <summary>
 
            /// The color to use to for shadow effects on the ToolStripSeparator.
 
            /// </summary>
 
            SeparatorDark,
 
            /// <summary>
 
            /// The color to use to for highlight effects on the ToolStripSeparator.
 
            /// </summary>
 
            SeparatorLight,
 
            /// <summary>
 
            /// The starting color of the gradient used on the StatusStrip.
 
            /// </summary>
 
            StatusStripGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used on the StatusStrip.
 
            /// </summary>
 
            StatusStripGradientEnd,
 
            /// <summary>
 
            /// The text color used on the StatusStrip.
 
            /// </summary>
 
			StatusStripText,
 
            /// <summary>
 
            /// The border color to use on the bottom edge of the ToolStrip.
 
            /// </summary>
 
            ToolStripBorder,
 
            /// <summary>
 
            /// The starting color of the gradient used in the ToolStripContentPanel.
 
            /// </summary>
 
            ToolStripContentPanelGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used in the ToolStripContentPanel.
 
            /// </summary>
 
            ToolStripContentPanelGradientEnd,
 
            /// <summary>
 
            /// The solid background color of the ToolStripDropDown.
 
            /// </summary>
 
            ToolStripDropDownBackground,
 
            /// <summary>
 
            /// The starting color of the gradient used in the ToolStrip background.
 
            /// </summary>
 
            ToolStripGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used in the ToolStrip background.
 
            /// </summary>
 
            ToolStripGradientEnd,
 
            /// <summary>
 
            /// The middle color of the gradient used in the ToolStrip background.
 
            /// </summary>
 
            ToolStripGradientMiddle,
 
            /// <summary>
 
            /// The starting color of the gradient used in the ToolStripPanel.
 
            /// </summary>
 
            ToolStripPanelGradientBegin,
 
            /// <summary>
 
            /// The end color of the gradient used in the ToolStripPanel.
 
            /// </summary>
 
            ToolStripPanelGradientEnd,
 
            /// <summary>
 
            /// The text color used on the ToolStrip.
 
            /// </summary>
 
            ToolStripText,
 
            /// <summary>
 
            /// 
 
            /// </summary>
 
            LastKnownColor = SeparatorLight
 
        }
 
 
        #endregion
 
 
        #region FieldsPrivate
 
 
		private Dictionary<KnownColors, Color> m_dictionaryRGBTable;
 
        private PanelColors m_panelColorTable;
 
 
		#endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets the border color to use with the <see cref="ButtonPressedGradientBegin"/>, <see cref="ButtonPressedGradientMiddle"/>, and <see cref="ButtonPressedGradientEnd"/> colors.
 
        /// </summary>
 
        /// <value>
 
        /// A <see cref="System.Drawing.Color"/> that is the border color to use with the <see cref="ButtonPressedGradientBegin"/>, <see cref="ButtonPressedGradientMiddle"/>, and <see cref="ButtonPressedGradientEnd"/> colors.
 
        /// </value>
 
        public override Color ButtonPressedBorder
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.ButtonPressedBorder);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used when the button is pressed down.
 
        /// </summary>
 
        public override Color ButtonPressedGradientBegin
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.ButtonPressedGradientBegin);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used when the button is pressed down.
 
        /// </summary>
 
        public override Color ButtonPressedGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ButtonPressedGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the middle color of the gradient used when the button is pressed down.
 
        /// </summary>
 
        public override Color ButtonPressedGradientMiddle
 
        {
 
            get
 
            {
 
				return this.FromKnownColor(KnownColors.ButtonPressedGradientMiddle);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used when the button is selected.
 
        /// </summary>
 
        public override Color ButtonSelectedBorder
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ButtonSelectedBorder);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used when the button is selected.
 
        /// </summary>
 
        public override Color ButtonSelectedGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ButtonSelectedGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used when the button is selected.
 
        /// </summary>
 
        public override Color ButtonSelectedGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ButtonSelectedGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the middle color of the gradient used when the button is selected.
 
        /// </summary>
 
        public override Color ButtonSelectedGradientMiddle
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ButtonSelectedGradientMiddle);
 
			}
 
        }
 
		
 
        /// <summary>
 
        /// Gets the border color to use with ButtonSelectedHighlight.
 
        /// </summary>
 
        public override Color ButtonSelectedHighlightBorder
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ButtonSelectedHighlightBorder);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the solid color to use when the check box is selected and gradients are being used.
 
        /// </summary>
 
        public override Color CheckBackground
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.CheckBackground);
 
			}
 
        }
 
		/// <summary>
 
		/// Gets the solid color to use when the check box is selected and gradients are being used.
 
		/// </summary>
 
		public override Color CheckSelectedBackground
 
		{
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.CheckSelectedBackground);
 
			}
 
		}
 
        /// <summary>
 
        /// Gets the color to use for shadow effects on the grip or move handle.
 
        /// </summary>
 
        public override Color GripDark
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.GripDark);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the color to use for highlight effects on the grip or move handle.
 
        /// </summary>
 
        public override Color GripLight
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.GripLight);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the image margin of a ToolStripDropDownMenu.
 
        /// </summary>
 
        public override Color ImageMarginGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ImageMarginGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the border color or a MenuStrip.
 
        /// </summary>
 
        public override Color MenuBorder
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuBorder);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the border color to use with a ToolStripMenuItem.
 
        /// </summary>
 
        public override Color MenuItemBorder
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemBorder);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used when a top-level ToolStripMenuItem is pressed down.
 
        /// </summary>
 
        public override Color MenuItemPressedGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemPressedGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used when a top-level ToolStripMenuItem is pressed down.
 
        /// </summary>
 
        public override Color MenuItemPressedGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemPressedGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the middle color of the gradient used when a top-level ToolStripMenuItem is pressed down.
 
        /// </summary>
 
        public override Color MenuItemPressedGradientMiddle
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemPressedGradientMiddle);
 
			}
 
        }
 
		/// <summary>
 
		/// Gets the solid color to use when a ToolStripMenuItem other than the top-level ToolStripMenuItem is selected.
 
		/// </summary>
 
		public override Color MenuItemSelected
 
		{
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemSelected);
 
			}
 
		}
 
		/// <summary>
 
		/// Gets the text color of a top-level ToolStripMenuItem.
 
		/// </summary>
 
		public virtual Color MenuItemText
 
		{
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemText);
 
			}
 
		}
 
        /// <summary>
 
        /// Gets the border color used when a top-level
 
        /// ToolStripMenuItem is selected.
 
        /// </summary>
 
        public virtual Color MenuItemTopLevelSelectedBorder
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.MenuItemTopLevelSelectedBorder);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used when a top-level
 
        /// ToolStripMenuItem is selected.
 
        /// </summary>
 
        public virtual Color MenuItemTopLevelSelectedGradientBegin
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.MenuItemTopLevelSelectedGradientBegin);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used when a top-level
 
        /// ToolStripMenuItem is selected.
 
        /// </summary>
 
        public virtual Color MenuItemTopLevelSelectedGradientEnd
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.MenuItemTopLevelSelectedGradientEnd);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the middle color of the gradient used when a top-level
 
        /// ToolStripMenuItem is selected.
 
        /// </summary>
 
        public virtual Color MenuItemTopLevelSelectedGradientMiddle
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.MenuItemTopLevelSelectedGradientMiddle);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used when the ToolStripMenuItem is selected.
 
        /// </summary>
 
        public override Color MenuItemSelectedGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemSelectedGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used when the ToolStripMenuItem is selected.
 
        /// </summary>
 
        public override Color MenuItemSelectedGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuItemSelectedGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the MenuStrip.
 
        /// </summary>
 
        public override Color MenuStripGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuStripGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used in the MenuStrip.
 
        /// </summary>
 
        public override Color MenuStripGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.MenuStripGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the ToolStripOverflowButton.
 
        /// </summary>
 
        public override Color OverflowButtonGradientBegin
 
        {
 
            get
 
            {
 
				return this.FromKnownColor(KnownColors.OverflowButtonGradientBegin);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used in the ToolStripOverflowButton.
 
        /// </summary>
 
        public override Color OverflowButtonGradientEnd
 
        {
 
            get
 
            {
 
				return this.FromKnownColor(KnownColors.OverflowButtonGradientEnd);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the middle color of the gradient used in the ToolStripOverflowButton.
 
        /// </summary>
 
        public override Color OverflowButtonGradientMiddle
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.OverflowButtonGradientMiddle);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the ToolStripContainer.
 
        /// </summary>
 
        public override Color RaftingContainerGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.RaftingContainerGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used in the ToolStripContainer.
 
        /// </summary>
 
        public override Color RaftingContainerGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.RaftingContainerGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the color to use to for shadow effects on the ToolStripSeparator.
 
        /// </summary>
 
        public override Color SeparatorDark
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.SeparatorDark);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the color to use to for highlight effects on the ToolStripSeparator.
 
        /// </summary>
 
        public override Color SeparatorLight
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.SeparatorLight);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used on the StatusStrip.
 
        /// </summary>
 
        public override Color StatusStripGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.StatusStripGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used on the StatusStrip.
 
        /// </summary>
 
        public override Color StatusStripGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.StatusStripGradientEnd);
 
			}
 
        }
 
		/// <summary>
 
		/// Gets the text color used on the StatusStrip.
 
		/// </summary>
 
		public virtual Color StatusStripText
 
		{
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.StatusStripText);
 
			}
 
		}
 
        /// <summary>
 
        /// Gets the border color to use on the bottom edge of the ToolStrip.
 
        /// </summary>
 
        public override Color ToolStripBorder
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripBorder);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the ToolStripContentPanel.
 
        /// </summary>
 
        public override Color ToolStripContentPanelGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripContentPanelGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used in the ToolStripContentPanel.
 
        /// </summary>
 
        public override Color ToolStripContentPanelGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripContentPanelGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the solid background color of the ToolStripDropDown.
 
        /// </summary>
 
        public override Color ToolStripDropDownBackground
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripDropDownBackground);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the ToolStrip background.
 
        /// </summary>
 
        public override Color ToolStripGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used in the ToolStrip background.
 
        /// </summary>
 
        public override Color ToolStripGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the middle color of the gradient used in the ToolStrip background.
 
        /// </summary>
 
        public override Color ToolStripGradientMiddle
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripGradientMiddle);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the starting color of the gradient used in the ToolStripPanel.
 
        /// </summary>
 
        public override Color ToolStripPanelGradientBegin
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripPanelGradientBegin);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the end color of the gradient used in the ToolStripPanel.
 
        /// </summary>
 
        public override Color ToolStripPanelGradientEnd
 
        {
 
			get
 
			{
 
				return this.FromKnownColor(KnownColors.ToolStripPanelGradientEnd);
 
			}
 
        }
 
        /// <summary>
 
        /// Gets the text color used on the ToolStrip.
 
        /// </summary>
 
        public virtual Color ToolStripText
 
        {
 
            get
 
            {
 
                return this.FromKnownColor(KnownColors.ToolStripText);
 
            }
 
        }
 
        /// <summary>
 
        /// Gets the associated ColorTable for the XPanderControls
 
        /// </summary>
 
        public virtual PanelColors PanelColorTable
 
        {
 
            get
 
            {
 
                if (this.m_panelColorTable == null)
 
                {
 
                    this.m_panelColorTable = new PanelColors();
 
                }
 
                return this.m_panelColorTable;
 
            }
 
        }
 
        /// <summary>
 
        /// Gets or sets a value indicating whether to use System.Drawing.SystemColors rather than colors that match the current visual style.
 
        /// </summary>
 
        public new bool UseSystemColors
 
        {
 
            get { return base.UseSystemColors; }
 
            set
 
            {
 
                if (value.Equals(base.UseSystemColors) == false)
 
                {
 
                    base.UseSystemColors = value;
 
                    if (this.m_dictionaryRGBTable != null)
 
                    {
 
                        this.m_dictionaryRGBTable.Clear();
 
                        this.m_dictionaryRGBTable = null;
 
                    }
 
                }
 
            }
 
        }
 
        internal Color FromKnownColor(KnownColors color)
 
        {
 
			return (Color)this.ColorTable[color];
 
        }
 
        
 
        private Dictionary<KnownColors, Color> ColorTable
 
        {
 
			get
 
			{
 
				if (this.m_dictionaryRGBTable == null)
 
				{
 
					this.m_dictionaryRGBTable = new Dictionary<KnownColors, Color>(0xd4);
 
					if ((this.UseSystemColors == true) || (ToolStripManager.VisualStylesEnabled == false))
 
					{
 
						InitBaseColors(this.m_dictionaryRGBTable);
 
					}
 
					else
 
					{
 
						InitColors(this.m_dictionaryRGBTable);
 
					}
 
				}
 
				return this.m_dictionaryRGBTable;
 
			}
 
        }
 
 
		#endregion
 
 
		#region MethodsPublic
 
		/// <summary>
 
        /// Initializes a new instance of the ProfessionalColorTable class.
 
        /// </summary>
 
        public ProfessionalColorTable()
 
        {
 
        }
 
 
        #endregion
 
 
        #region MethodsProtected
 
        /// <summary>
 
        /// Initialize a color Dictionary with defined colors
 
        /// </summary>
 
        /// <param name="rgbTable">Dictionary with defined colors</param>
 
        protected virtual void InitColors(Dictionary<KnownColors, Color> rgbTable)
 
        {
 
            InitBaseColors(rgbTable);
 
        }
 
        #endregion
 
 
        #region MethodsPrivate
 
 
		private void InitBaseColors(Dictionary<KnownColors, Color> rgbTable)
 
		{
 
            rgbTable[KnownColors.ButtonPressedBorder] = base.ButtonPressedBorder;
 
            rgbTable[KnownColors.ButtonPressedGradientBegin] = base.ButtonPressedGradientBegin;
 
			rgbTable[KnownColors.ButtonPressedGradientEnd] = base.ButtonPressedGradientEnd;
 
			rgbTable[KnownColors.ButtonPressedGradientMiddle] = base.ButtonPressedGradientMiddle;
 
			rgbTable[KnownColors.ButtonSelectedBorder] = base.ButtonSelectedBorder;
 
			rgbTable[KnownColors.ButtonSelectedGradientBegin] = base.ButtonSelectedGradientBegin;
 
			rgbTable[KnownColors.ButtonSelectedGradientEnd] = base.ButtonSelectedGradientEnd;
 
			rgbTable[KnownColors.ButtonSelectedGradientMiddle] = base.ButtonSelectedGradientMiddle;
 
			rgbTable[KnownColors.ButtonSelectedHighlightBorder] = base.ButtonSelectedHighlightBorder;
 
			rgbTable[KnownColors.CheckBackground] = base.CheckBackground;
 
			rgbTable[KnownColors.CheckSelectedBackground] = base.CheckSelectedBackground;
 
			rgbTable[KnownColors.GripDark] = base.GripDark;
 
			rgbTable[KnownColors.GripLight] = base.GripLight;
 
			rgbTable[KnownColors.ImageMarginGradientBegin] = base.ImageMarginGradientBegin;
 
			rgbTable[KnownColors.MenuBorder] = base.MenuBorder;
 
			rgbTable[KnownColors.MenuItemBorder] = base.MenuItemBorder;
 
			rgbTable[KnownColors.MenuItemPressedGradientBegin] = base.MenuItemPressedGradientBegin;
 
			rgbTable[KnownColors.MenuItemPressedGradientEnd] = base.MenuItemPressedGradientEnd;
 
			rgbTable[KnownColors.MenuItemPressedGradientMiddle] = base.MenuItemPressedGradientMiddle;
 
			rgbTable[KnownColors.MenuItemSelected] = base.MenuItemSelected;
 
			rgbTable[KnownColors.MenuItemSelectedGradientBegin] = base.MenuItemSelectedGradientBegin;
 
			rgbTable[KnownColors.MenuItemSelectedGradientEnd] = base.MenuItemSelectedGradientEnd;
 
			rgbTable[KnownColors.MenuItemText] = Color.FromArgb(0, 0, 0);
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedBorder] = base.MenuItemBorder;
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedGradientBegin] = base.MenuItemSelected;
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedGradientEnd] = base.MenuItemSelected;
 
            rgbTable[KnownColors.MenuItemTopLevelSelectedGradientMiddle] = base.MenuItemSelected;
 
            rgbTable[KnownColors.MenuStripGradientBegin] = base.MenuStripGradientBegin;
 
			rgbTable[KnownColors.MenuStripGradientEnd] = base.MenuStripGradientEnd;
 
			rgbTable[KnownColors.OverflowButtonGradientBegin] = base.OverflowButtonGradientBegin;
 
			rgbTable[KnownColors.OverflowButtonGradientEnd] = base.OverflowButtonGradientEnd;
 
			rgbTable[KnownColors.OverflowButtonGradientMiddle] = base.OverflowButtonGradientMiddle;
 
			rgbTable[KnownColors.RaftingContainerGradientBegin] = base.RaftingContainerGradientBegin;
 
			rgbTable[KnownColors.RaftingContainerGradientEnd] = base.RaftingContainerGradientEnd;
 
			rgbTable[KnownColors.SeparatorDark] = base.SeparatorDark;
 
			rgbTable[KnownColors.SeparatorLight] = base.SeparatorLight;
 
			rgbTable[KnownColors.StatusStripGradientBegin] = base.StatusStripGradientEnd;
 
			rgbTable[KnownColors.StatusStripGradientEnd] = base.StatusStripGradientBegin;
 
			rgbTable[KnownColors.StatusStripText] = Color.FromArgb(0, 0, 0);
 
			rgbTable[KnownColors.ToolStripBorder] = base.ToolStripBorder;
 
			rgbTable[KnownColors.ToolStripContentPanelGradientBegin] = base.ToolStripContentPanelGradientBegin;
 
			rgbTable[KnownColors.ToolStripContentPanelGradientEnd] = base.ToolStripContentPanelGradientEnd;
 
			rgbTable[KnownColors.ToolStripDropDownBackground] = base.ToolStripDropDownBackground;
 
			rgbTable[KnownColors.ToolStripGradientBegin] = base.ToolStripGradientBegin;
 
			rgbTable[KnownColors.ToolStripGradientEnd] = base.ToolStripGradientEnd;
 
			rgbTable[KnownColors.ToolStripGradientMiddle] = base.ToolStripGradientMiddle;
 
			rgbTable[KnownColors.ToolStripPanelGradientBegin] = base.ToolStripPanelGradientBegin;
 
			rgbTable[KnownColors.ToolStripPanelGradientEnd] = base.ToolStripPanelGradientEnd;
 
            rgbTable[KnownColors.ToolStripText] = Color.FromArgb(0, 0, 0);
 
		}
 
 
		#endregion
 
	}
 
}
Demo.WindowsForms/BSE.Windows.Forms/Resources/ChevronDown.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/ChevronLeft.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/ChevronRight.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/ChevronUp.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/Collapse.jpg
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/Collapse_h.jpg
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/Expand.jpg
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/Expand_h.jpg
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Resources/Resources.Designer.cs
Show inline comments
 
new file 100644
 
//------------------------------------------------------------------------------
 
// <auto-generated>
 
//     This code was generated by a tool.
 
//     Runtime Version:2.0.50727.1434
 
//
 
//     Changes to this file may cause incorrect behavior and will be lost if
 
//     the code is regenerated.
 
// </auto-generated>
 
//------------------------------------------------------------------------------
 
 
namespace BSE.Windows.Forms.Properties {
 
    using System;
 
    
 
    
 
    /// <summary>
 
    ///   A strongly-typed resource class, for looking up localized strings, etc.
 
    /// </summary>
 
    // This class was auto-generated by the StronglyTypedResourceBuilder
 
    // class via a tool like ResGen or Visual Studio.
 
    // To add or remove a member, edit your .ResX file then rerun ResGen
 
    // with the /str option, or rebuild your VS project.
 
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
 
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
 
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
 
    internal class Resources {
 
        
 
        private static global::System.Resources.ResourceManager resourceMan;
 
        
 
        private static global::System.Globalization.CultureInfo resourceCulture;
 
        
 
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
 
        internal Resources() {
 
        }
 
        
 
        /// <summary>
 
        ///   Returns the cached ResourceManager instance used by this class.
 
        /// </summary>
 
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
 
        internal static global::System.Resources.ResourceManager ResourceManager {
 
            get {
 
                if (object.ReferenceEquals(resourceMan, null)) {
 
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BSE.Windows.Forms.Properties.Resources", typeof(Resources).Assembly);
 
                    resourceMan = temp;
 
                }
 
                return resourceMan;
 
            }
 
        }
 
        
 
        /// <summary>
 
        ///   Overrides the current thread's CurrentUICulture property for all
 
        ///   resource lookups using this strongly typed resource class.
 
        /// </summary>
 
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
 
        internal static global::System.Globalization.CultureInfo Culture {
 
            get {
 
                return resourceCulture;
 
            }
 
            set {
 
                resourceCulture = value;
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap ChevronDown {
 
            get {
 
                object obj = ResourceManager.GetObject("ChevronDown", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap ChevronLeft {
 
            get {
 
                object obj = ResourceManager.GetObject("ChevronLeft", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap ChevronRight {
 
            get {
 
                object obj = ResourceManager.GetObject("ChevronRight", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap ChevronUp {
 
            get {
 
                object obj = ResourceManager.GetObject("ChevronUp", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap closePanel {
 
            get {
 
                object obj = ResourceManager.GetObject("closePanel", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap Collapse {
 
            get {
 
                object obj = ResourceManager.GetObject("Collapse", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap Collapse_h {
 
            get {
 
                object obj = ResourceManager.GetObject("Collapse_h", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap Expand {
 
            get {
 
                object obj = ResourceManager.GetObject("Expand", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap Expand_h {
 
            get {
 
                object obj = ResourceManager.GetObject("Expand_h", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
        
 
        /// <summary>
 
        ///   Looks up a localized string similar to Parameter {0} can&apos;t be null.
 
        /// </summary>
 
        internal static string IDS_ArgumentException {
 
            get {
 
                return ResourceManager.GetString("IDS_ArgumentException", resourceCulture);
 
            }
 
        }
 
        
 
        /// <summary>
 
        ///   Looks up a localized string similar to Value of &apos;{0}&apos; is not valid for &apos;{1}&apos;. &apos;Value&apos; should be between &apos;{2}&apos; and &apos;{3}&apos;.
 
        ///Parameter name: {1}.
 
        /// </summary>
 
        internal static string IDS_InvalidBoundArgument {
 
            get {
 
                return ResourceManager.GetString("IDS_InvalidBoundArgument", resourceCulture);
 
            }
 
        }
 
        
 
        /// <summary>
 
        ///   Looks up a localized string similar to Value of &apos;{0}&apos; is not valid for &apos;{1}&apos;. &apos;Maximum&apos; must be greater than or equal to 0.
 
        ///Parameter name: {1}.
 
        /// </summary>
 
        internal static string IDS_InvalidLowBoundArgument {
 
            get {
 
                return ResourceManager.GetString("IDS_InvalidLowBoundArgument", resourceCulture);
 
            }
 
        }
 
        
 
        /// <summary>
 
        ///   Looks up a localized string similar to Value of &apos;{0}&apos; is not valid for &apos;{1}&apos;. &apos;{1}&apos; must be greater than or equal to {2}.
 
        ///Parameter name: {1}.
 
        /// </summary>
 
        internal static string IDS_InvalidOperationExceptionInteger {
 
            get {
 
                return ResourceManager.GetString("IDS_InvalidOperationExceptionInteger", resourceCulture);
 
            }
 
        }
 
        
 
        internal static System.Drawing.Bitmap ListViewItemSorter {
 
            get {
 
                object obj = ResourceManager.GetObject("ListViewItemSorter", resourceCulture);
 
                return ((System.Drawing.Bitmap)(obj));
 
            }
 
        }
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/Resources/Resources.resx
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="utf-8"?>
 
<root>
 
  <!-- 
 
    Microsoft ResX Schema 
 
    
 
    Version 2.0
 
    
 
    The primary goals of this format is to allow a simple XML format 
 
    that is mostly human readable. The generation and parsing of the 
 
    various data types are done through the TypeConverter classes 
 
    associated with the data types.
 
    
 
    Example:
 
    
 
    ... ado.net/XML headers & schema ...
 
    <resheader name="resmimetype">text/microsoft-resx</resheader>
 
    <resheader name="version">2.0</resheader>
 
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
 
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
 
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
 
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
 
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
 
        <value>[base64 mime encoded serialized .NET Framework object]</value>
 
    </data>
 
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
 
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
 
        <comment>This is a comment</comment>
 
    </data>
 
                
 
    There are any number of "resheader" rows that contain simple 
 
    name/value pairs.
 
    
 
    Each data row contains a name, and value. The row also contains a 
 
    type or mimetype. Type corresponds to a .NET class that support 
 
    text/value conversion through the TypeConverter architecture. 
 
    Classes that don't support this are serialized and stored with the 
 
    mimetype set.
 
    
 
    The mimetype is used for serialized objects, and tells the 
 
    ResXResourceReader how to depersist the object. This is currently not 
 
    extensible. For a given mimetype the value must be set accordingly:
 
    
 
    Note - application/x-microsoft.net.object.binary.base64 is the format 
 
    that the ResXResourceWriter will generate, however the reader can 
 
    read any of the formats listed below.
 
    
 
    mimetype: application/x-microsoft.net.object.binary.base64
 
    value   : The object must be serialized with 
 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
 
            : and then encoded with base64 encoding.
 
    
 
    mimetype: application/x-microsoft.net.object.soap.base64
 
    value   : The object must be serialized with 
 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
 
            : and then encoded with base64 encoding.
 
 
    mimetype: application/x-microsoft.net.object.bytearray.base64
 
    value   : The object must be serialized into a byte array 
 
            : using a System.ComponentModel.TypeConverter
 
            : and then encoded with base64 encoding.
 
    -->
 
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
 
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
 
    <xsd:element name="root" msdata:IsDataSet="true">
 
      <xsd:complexType>
 
        <xsd:choice maxOccurs="unbounded">
 
          <xsd:element name="metadata">
 
            <xsd:complexType>
 
              <xsd:sequence>
 
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
 
              </xsd:sequence>
 
              <xsd:attribute name="name" use="required" type="xsd:string" />
 
              <xsd:attribute name="type" type="xsd:string" />
 
              <xsd:attribute name="mimetype" type="xsd:string" />
 
              <xsd:attribute ref="xml:space" />
 
            </xsd:complexType>
 
          </xsd:element>
 
          <xsd:element name="assembly">
 
            <xsd:complexType>
 
              <xsd:attribute name="alias" type="xsd:string" />
 
              <xsd:attribute name="name" type="xsd:string" />
 
            </xsd:complexType>
 
          </xsd:element>
 
          <xsd:element name="data">
 
            <xsd:complexType>
 
              <xsd:sequence>
 
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
 
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
 
              </xsd:sequence>
 
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
 
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
 
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
 
              <xsd:attribute ref="xml:space" />
 
            </xsd:complexType>
 
          </xsd:element>
 
          <xsd:element name="resheader">
 
            <xsd:complexType>
 
              <xsd:sequence>
 
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
 
              </xsd:sequence>
 
              <xsd:attribute name="name" type="xsd:string" use="required" />
 
            </xsd:complexType>
 
          </xsd:element>
 
        </xsd:choice>
 
      </xsd:complexType>
 
    </xsd:element>
 
  </xsd:schema>
 
  <resheader name="resmimetype">
 
    <value>text/microsoft-resx</value>
 
  </resheader>
 
  <resheader name="version">
 
    <value>2.0</value>
 
  </resheader>
 
  <resheader name="reader">
 
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 
  </resheader>
 
  <resheader name="writer">
 
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 
  </resheader>
 
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 
  <data name="ChevronDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\Resources\ChevronDown.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="ChevronLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\Resources\ChevronLeft.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="ChevronRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\Resources\ChevronRight.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="ChevronUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\Resources\ChevronUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="closePanel" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\Resources\closePanel.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="Collapse" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\resources\collapse.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="Collapse_h" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\resources\collapse_h.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="Expand" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\resources\expand.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="Expand_h" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\resources\expand_h.jpg;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="IDS_ArgumentException" xml:space="preserve">
 
    <value>Parameter {0} can't be null</value>
 
  </data>
 
  <data name="IDS_InvalidOperationExceptionInteger" xml:space="preserve">
 
    <value>Value of '{0}' is not valid for '{1}'. '{1}' must be greater than or equal to {2}.
 
Parameter name: {1}</value>
 
  </data>
 
  <data name="ListViewItemSorter" type="System.Resources.ResXFileRef, System.Windows.Forms">
 
    <value>..\Resources\ListViewItemSorter.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
 
  </data>
 
  <data name="IDS_InvalidBoundArgument" xml:space="preserve">
 
    <value>Value of '{0}' is not valid for '{1}'. 'Value' should be between '{2}' and '{3}'.
 
Parameter name: {1}</value>
 
  </data>
 
  <data name="IDS_InvalidLowBoundArgument" xml:space="preserve">
 
    <value>Value of '{0}' is not valid for '{1}'. 'Maximum' must be greater than or equal to 0.
 
Parameter name: {1}</value>
 
  </data>
 
</root>
 
\ No newline at end of file
Demo.WindowsForms/BSE.Windows.Forms/Resources/closePanel.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
Demo.WindowsForms/BSE.Windows.Forms/Splitter/Splitter.Designer.cs
Show inline comments
 
new file 100644
 
namespace BSE.Windows.Forms
 
{
 
	partial class Splitter
 
	{
 
		/// <summary> 
 
		/// Required designer variable.
 
		/// </summary>
 
		private System.ComponentModel.IContainer components = null;
 
 
		/// <summary> 
 
		/// Clean up any resources being used.
 
		/// </summary>
 
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 
		protected override void Dispose(bool disposing)
 
		{
 
			if (disposing && (components != null))
 
			{
 
				components.Dispose();
 
			}
 
			base.Dispose(disposing);
 
		}
 
 
		#region Component Designer generated code
 
 
		/// <summary> 
 
		/// Required method for Designer support - do not modify 
 
		/// the contents of this method with the code editor.
 
		/// </summary>
 
		private void InitializeComponent()
 
		{
 
			components = new System.ComponentModel.Container();
 
		}
 
 
		#endregion
 
	}
 
}
Demo.WindowsForms/BSE.Windows.Forms/Splitter/Splitter.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.ComponentModel;
 
using System.Drawing;
 
using System.Data;
 
using System.Text;
 
using System.Windows.Forms;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Represents a splitter control that enables the user to resize docked controls.
 
    /// </summary>
 
    /// <remarks>
 
    /// The splitter control supports in difference to the <see cref="System.Windows.Forms.Splitter"/> the using
 
    /// of a transparent backcolor.
 
    /// </remarks>
 
    /// <copyright>Copyright © 2006-2008 Uwe Eichkorn
 
    /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
    /// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
    /// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
    /// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
    /// REMAINS UNCHANGED.
 
    /// </copyright>
 
    [DesignTimeVisibleAttribute(true)]
 
	[ToolboxBitmap(typeof(System.Windows.Forms.Splitter))]
 
	public partial class Splitter : System.Windows.Forms.Splitter
 
	{
 
		#region MethodsPublic
 
		/// <summary>
 
        /// Initializes a new instance of the Splitter class.
 
		/// </summary>
 
		public Splitter()
 
		{
 
            //The System.Windows.Forms.Splitter doesn't suports a transparent backcolor
 
            //With this, the using of a transparent backcolor is possible
 
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
 
			InitializeComponent();
 
            this.BackColor = Color.Transparent;
 
		}
 
 
		#endregion
 
	}
 
}
Demo.WindowsForms/BSE.Windows.Forms/XPander/BasePanel.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Text;
 
using System.Drawing;
 
using System.Drawing.Drawing2D;
 
using System.Windows.Forms;
 
using System.ComponentModel;
 
using Demo.WindowsForms.Properties;
 
 
namespace BSE.Windows.Forms
 
{
 
   /// <summary>
 
   /// Base class for the panel or xpanderpanel control. 
 
   /// </summary>
 
   /// <copyright>Copyright © 2006-2008 Uwe Eichkorn
 
   /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
   /// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
   /// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
   /// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
   /// REMAINS UNCHANGED. 
 
   /// </copyright>
 
   [DesignTimeVisibleAttribute(false)]
 
   public class BasePanel : ScrollableControl, IPanel
 
   {
 
      #region Constants
 
 
      /// <summary>
 
      /// padding value for the panel
 
      /// </summary>
 
      public const int CaptionSpacing = 6;
 
 
      #endregion
 
 
      #region Events
 
      /// <summary>
 
      /// Occurs when the close icon in the caption of the panel or xpanderpanel is clicked. 
 
      /// </summary>
 
      [Description("Occurs when the close icon in the caption of the panel or xpanderpanel is clicked.")]
 
      public event EventHandler<EventArgs> CloseClick;
 
      /// <summary>
 
      /// Occurs when the expand icon in the caption of the panel or xpanderpanel is clicked. 
 
      /// </summary>
 
      [Description("Occurs when the expand icon in the caption of the panel or xpanderpanel is clicked.")]
 
      public event EventHandler<EventArgs> ExpandClick;
 
      /// <summary>
 
      /// Occurs when the panel or xpanderpanel expands.
 
      /// </summary>
 
      [Description("Occurs when the panel or xpanderpanel expands.")]
 
      public event EventHandler<XPanderStateChangeEventArgs> PanelExpanding;
 
      /// <summary>
 
      /// Occurs when the panel or xpanderpanel collapse.
 
      /// </summary>
 
      [Description("Occurs when the panel or xpanderpanel collapse.")]
 
      public event EventHandler<XPanderStateChangeEventArgs> PanelCollapsing;
 
      /// <summary>
 
      /// The PanelStyleChanged event occurs when PanelStyle flags have been changed.
 
      /// </summary>
 
      [Description("The PanelStyleChanged event occurs when PanelStyle flags have been changed.")]
 
      public event EventHandler<PanelStyleChangeEventArgs> PanelStyleChanged;
 
      /// <summary>
 
      /// The ColorSchemeChanged event occurs when ColorScheme flags have been changed.
 
      /// </summary>
 
      [Description("The ColorSchemeChanged event occurs when ColorScheme flags have been changed.")]
 
      public event EventHandler<ColorSchemeChangeEventArgs> ColorSchemeChanged;
 
      /// <summary>
 
      /// Occurs when the value of the CustomColors property changes.
 
      /// </summary>
 
      [Description("Occurs when the value of the CustomColors property changes.")]
 
      public event EventHandler<EventArgs> CustomColorsChanged;
 
      /// <summary>
 
      /// Occurs when the value of the CaptionHeight property changes.
 
      /// </summary>
 
      [Description("Occurs when the value of the CaptionHeight property changes.")]
 
      public event EventHandler<EventArgs> CaptionHeightChanged;
 
      /// <summary>
 
      /// Occurs when the value of the CaptionBar HoverState changes.
 
      /// </summary>
 
      [Description("Occurs when the value of the CaptionBar HoverState changes.")]
 
      public event EventHandler<HoverStateChangeEventArgs> CaptionBarHoverStateChanged;
 
      /// <summary>
 
      /// Occurs when the value of the CloseIcon HoverState changes.
 
      /// </summary>
 
      [Description("Occurs when the value of the CloseIcon HoverState changes.")]
 
      protected event EventHandler<HoverStateChangeEventArgs> CloseIconHoverStateChanged;
 
      /// <summary>
 
      /// Occurs when the value of the ExpandIcon HoverState changes.
 
      /// </summary>
 
      [Description("Occurs when the value of the ExpandIcon HoverState changes.")]
 
      protected event EventHandler<HoverStateChangeEventArgs> ExpandIconHoverStateChanged;
 
      #endregion
 
 
      #region FieldsPrivate
 
 
      private int m_iCaptionHeight;
 
      private Font m_captionFont;
 
      private Rectangle m_imageRectangle;
 
      private bool m_bShowBorder;
 
      private bool m_bExpand;
 
      private Size m_imageSize;
 
      private BSE.Windows.Forms.ColorScheme m_eColorScheme;
 
      private PanelColors m_panelColors;
 
      private PanelStyle m_ePanelStyle;
 
      private Image m_image;
 
      private HoverState m_hoverStateCaptionBar;
 
      private HoverState m_hoverStateExpandIcon;
 
      private string m_strToolTipTextExpandIconPanelExpanded;
 
      private string m_strToolTipTextExpandIconPanelCollapsed;
 
      private HoverState m_hoverStateCloseIcon;
 
      private string m_strToolTipTextCloseIcon;
 
      private bool m_bShowExpandIcon;
 
      private bool m_bShowCloseIcon;
 
      private System.Windows.Forms.ToolTip m_toolTip;
 
 
      #endregion
 
 
      #region FieldsProtected
 
      /// <summary>
 
      /// The rectangle that contains the expand panel icon
 
      /// </summary>
 
      protected Rectangle RectangleExpandIcon = Rectangle.Empty;
 
      /// <summary>
 
      /// The rectangle that contains the close panel icon
 
      /// </summary>
 
      protected Rectangle RectangleCloseIcon = Rectangle.Empty;
 
 
      #endregion
 
 
      #region Properties
 
      /// <summary>
 
      /// Gets or sets the style of the panel.
 
      /// </summary>
 
      [Description("Style of the panel")]
 
      [DefaultValue(0)]
 
      [Category("Appearance")]
 
      public virtual BSE.Windows.Forms.PanelStyle PanelStyle
 
      {
 
         get
 
         {
 
            return this.m_ePanelStyle;
 
         }
 
         set
 
         {
 
            if(value.Equals(this.m_ePanelStyle) == false)
 
            {
 
               this.m_ePanelStyle = value;
 
               OnPanelStyleChanged(this, new PanelStyleChangeEventArgs(this.m_ePanelStyle));
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the image that is displayed on a Panels caption.
 
      /// </summary>
 
      [Description("Gets or sets the image that is displayed on a Panels caption.")]
 
      [Category("Appearance")]
 
      public Image Image
 
      {
 
         get
 
         {
 
            return this.m_image;
 
         }
 
         set
 
         {
 
            if(value != this.m_image)
 
            {
 
               this.m_image = value;
 
               this.Invalidate(this.CaptionRectangle);
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the color schema which is used for the panel.
 
      /// </summary>
 
      [Description("ColorScheme of the Panel")]
 
      [DefaultValue(BSE.Windows.Forms.ColorScheme.Professional)]
 
      [Browsable(true)]
 
      [Category("Appearance")]
 
      public virtual BSE.Windows.Forms.ColorScheme ColorScheme
 
      {
 
         get
 
         {
 
            return this.m_eColorScheme;
 
         }
 
         set
 
         {
 
            if(value.Equals(this.m_eColorScheme) == false)
 
            {
 
               this.m_eColorScheme = value;
 
               OnColorSchemeChanged(this, new ColorSchemeChangeEventArgs(this.m_eColorScheme));
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the height of the panels caption.  
 
      /// </summary>
 
      [Description("Gets or sets the height of the panels caption."),
 
    DefaultValue(25),
 
    Category("Appearance")]
 
      public int CaptionHeight
 
      {
 
         get
 
         {
 
            return m_iCaptionHeight;
 
         }
 
         set
 
         {
 
            if(value < Constants.CaptionMinHeight)
 
            {
 
               throw new InvalidOperationException(
 
                   string.Format(
 
                   System.Globalization.CultureInfo.CurrentUICulture,
 
                   Resources.IDS_InvalidOperationExceptionInteger, value, "CaptionHeight", Constants.CaptionMinHeight));
 
            }
 
            this.m_iCaptionHeight = value;
 
            OnCaptionHeightChanged(this, EventArgs.Empty);
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the font of the text displayed on the caption.
 
      /// </summary>
 
      [Description("Gets or sets the font of the text displayed on the caption.")]
 
      [DefaultValue(typeof(Font), "Microsoft Sans Serif; 8,25pt; style=Bold")]
 
      [Category("Appearance")]
 
      public Font CaptionFont
 
      {
 
         get
 
         {
 
            return this.m_captionFont;
 
         }
 
         set
 
         {
 
            if(value != null)
 
            {
 
               if(value.Equals(this.m_captionFont) == false)
 
               {
 
                  this.m_captionFont = value;
 
                  this.Invalidate(this.CaptionRectangle);
 
               }
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Expands the panel or xpanderpanel.
 
      /// </summary>
 
      [Description("Expand the panel or xpanderpanel")]
 
      [DefaultValue(false)]
 
      [Category("Appearance")]
 
      [RefreshProperties(RefreshProperties.Repaint)]
 
      public virtual bool Expand
 
      {
 
         get
 
         {
 
            return this.m_bExpand;
 
         }
 
         set
 
         {
 
            if(value.Equals(this.m_bExpand) == false)
 
            {
 
               this.m_bExpand = value;
 
               if(this.m_bExpand == true)
 
               {
 
                  OnPanelExpanding(this, new XPanderStateChangeEventArgs(this.m_bExpand));
 
               }
 
               else
 
               {
 
                  OnPanelCollapsing(this, new XPanderStateChangeEventArgs(this.m_bExpand));
 
               }
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets a value indicating whether the control shows a border.
 
      /// </summary>
 
      [Description("Gets or sets a value indicating whether the control shows a border")]
 
      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
 
      [DefaultValue(true)]
 
      [Browsable(false)]
 
      [Category("Appearance")]
 
      public virtual bool ShowBorder
 
      {
 
         get
 
         {
 
            return this.m_bShowBorder;
 
         }
 
         set
 
         {
 
            if(value.Equals(this.m_bShowBorder) == false)
 
            {
 
               this.m_bShowBorder = value;
 
               this.Invalidate(false);
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets a value indicating whether the expand icon in a Panel or XPanderPanel is visible.
 
      /// </summary>
 
      [Description("Gets or sets a value indicating whether the expand icon in a Panel or XPanderPanel is visible.")]
 
      [DefaultValue(false)]
 
      [Category("Appearance")]
 
      public virtual bool ShowExpandIcon
 
      {
 
         get
 
         {
 
            return this.m_bShowExpandIcon;
 
         }
 
         set
 
         {
 
            if(value.Equals(this.m_bShowExpandIcon) == false)
 
            {
 
               this.m_bShowExpandIcon = value;
 
               this.Invalidate(false);
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the text that appears as a ToolTip on a panel when the mouse
 
      /// movers over the closeicon.
 
      /// </summary>
 
      /// <value>
 
      /// Type:<see cref="System.String"/>
 
      /// A string representing the ToolTip text when the mouse moves over the closeicon.
 
      /// </value>
 
      [Description("Specifies the text to show on a ToolTip when the mouse moves over the closeicon.")]
 
      [Category("Behavior")]
 
      public virtual string ToolTipTextCloseIcon
 
      {
 
         get
 
         {
 
            return this.m_strToolTipTextCloseIcon;
 
         }
 
         set
 
         {
 
            this.m_strToolTipTextCloseIcon = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the text that appears as a ToolTip on a panel when the mouse
 
      /// movers over the expandicon and the panel is collapsed. 
 
      /// </summary>
 
      /// <value>
 
      /// Type:<see cref="System.String"/>
 
      /// A string representing the ToolTip text.
 
      /// </value> 
 
      [Description("Specifies the text to show on a ToolTip when the mouse moves over the expandicon and the panel is collapsed.")]
 
      [Category("Behavior")]
 
      public virtual string ToolTipTextExpandIconPanelCollapsed
 
      {
 
         get
 
         {
 
            return this.m_strToolTipTextExpandIconPanelCollapsed;
 
         }
 
         set
 
         {
 
            this.m_strToolTipTextExpandIconPanelCollapsed = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the text that appears as a ToolTip on a panel when the mouse
 
      /// movers over the expandicon and the panel is expanded.
 
      /// </summary>
 
      /// <value>
 
      /// Type:<see cref="System.String"/>
 
      /// A string representing the ToolTip text when the mouse moves over the expandicon and the panel is expanded.
 
      /// </value> 
 
      [Description("Specifies the text to show on a ToolTip when the mouse moves over the expandicon and the panel is expanded.")]
 
      [Category("Behavior")]
 
      public virtual string ToolTipTextExpandIconPanelExpanded
 
      {
 
         get
 
         {
 
            return this.m_strToolTipTextExpandIconPanelExpanded;
 
         }
 
         set
 
         {
 
            this.m_strToolTipTextExpandIconPanelExpanded = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets a value indicating whether the close icon in a Panel or XPanderPanel is visible.
 
      /// </summary>
 
      [Description("Gets or sets a value indicating whether the close icon in a Panel or XPanderPanel is visible.")]
 
      [DefaultValue(false)]
 
      [Category("Appearance")]
 
      public virtual bool ShowCloseIcon
 
      {
 
         get
 
         {
 
            return this.m_bShowCloseIcon;
 
         }
 
         set
 
         {
 
            if(value.Equals(this.m_bShowCloseIcon) == false)
 
            {
 
               this.m_bShowCloseIcon = value;
 
               this.Invalidate(false);
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Gets the panelcolors table.
 
      /// </summary>
 
      protected PanelColors PanelColors
 
      {
 
         get
 
         {
 
            return m_panelColors;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the HoverState of the CaptionBar at a Panel or XPanderPanel.
 
      /// </summary>
 
      internal HoverState HoverStateCaptionBar
 
      {
 
         get
 
         {
 
            return this.m_hoverStateCaptionBar;
 
         }
 
         set
 
         {
 
            this.m_hoverStateCaptionBar = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the HoverState of the CloseIcon in a captionbar at a Panel or XPanderPanel.
 
      /// </summary>
 
      internal HoverState HoverStateCloseIcon
 
      {
 
         get
 
         {
 
            return this.m_hoverStateCloseIcon;
 
         }
 
         set
 
         {
 
            this.m_hoverStateCloseIcon = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the HoverState of the ExpandIcon in a captionbar at a Panel or XPanderPanel.
 
      /// </summary>
 
      internal HoverState HoverStateExpandIcon
 
      {
 
         get
 
         {
 
            return this.m_hoverStateExpandIcon;
 
         }
 
         set
 
         {
 
            this.m_hoverStateExpandIcon = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets or sets the size of an image in the captionbar.
 
      /// </summary>
 
      internal Size ImageSize
 
      {
 
         get
 
         {
 
            return this.m_imageSize;
 
         }
 
         set
 
         {
 
            this.m_imageSize = value;
 
         }
 
      }
 
      /// <summary>
 
      /// Gets the size of a captionbar in a Panel or XPanderPanel
 
      /// </summary>
 
      internal Rectangle CaptionRectangle
 
      {
 
         get
 
         {
 
            return new Rectangle(0, 0, this.ClientRectangle.Width, this.CaptionHeight);
 
         }
 
      }
 
      /// <summary>
 
      /// Gets the Rectangle of an Image in a captionbar
 
      /// </summary>
 
      internal Rectangle ImageRectangle
 
      {
 
         get
 
         {
 
            if(this.m_imageRectangle == Rectangle.Empty)
 
            {
 
               this.m_imageRectangle = new Rectangle(
 
                   CaptionSpacing,
 
                   this.CaptionHeight,
 
                   this.m_imageSize.Width,
 
                   this.m_imageSize.Height);
 
            }
 
            return this.m_imageRectangle;
 
         }
 
      }
 
      #endregion
 
 
      #region MethodsPublic
 
      /// <summary>
 
      /// Sets the PanelProperties for a Panel or XPanderPanel
 
      /// </summary>
 
      /// <param name="panelColors">The PanelColors table</param>
 
      public virtual void SetPanelProperties(PanelColors panelColors)
 
      {
 
         if(panelColors == null)
 
         {
 
            throw new ArgumentException(
 
                string.Format(
 
                System.Globalization.CultureInfo.CurrentUICulture,
 
                Resources.IDS_ArgumentException,
 
                "panelColors"));
 
         }
 
         this.m_panelColors = panelColors;
 
         this.ColorScheme = ColorScheme.Professional;
 
         this.Invalidate(true);
 
      }
 
      #endregion
 
 
      #region MethodsProtected
 
      /// <summary>
 
      /// Initializes a new instance of the BasePanel class.
 
      /// </summary>
 
      protected BasePanel()
 
      {
 
         this.SetStyle(ControlStyles.ResizeRedraw, true);
 
         this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
 
         this.SetStyle(ControlStyles.UserPaint, true);
 
         this.SetStyle(ControlStyles.DoubleBuffer, true);
 
         this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
 
         this.SetStyle(ControlStyles.ContainerControl, true);
 
         this.CaptionFont = new Font(SystemFonts.CaptionFont.FontFamily, SystemFonts.CaptionFont.SizeInPoints - 1.0F, FontStyle.Bold);
 
         this.CaptionHeight = 25;
 
         this.PanelStyle = PanelStyle.Default;
 
         this.m_panelColors = new PanelColors(this);
 
         this.m_imageSize = new Size(16, 16);
 
         this.m_imageRectangle = Rectangle.Empty;
 
         this.m_toolTip = new System.Windows.Forms.ToolTip();
 
 
      }
 
      /// <summary>
 
      /// Raises the TextChanged event.
 
      /// </summary>
 
      /// <param name="e">An EventArgs that contains the event data.</param>
 
      protected override void OnTextChanged(EventArgs e)
 
      {
 
         this.Invalidate(this.CaptionRectangle);
 
         base.OnTextChanged(e);
 
      }
 
      /// <summary>
 
      /// Raises the ColorScheme changed event
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A EventArgs that contains the event data.</param>
 
      protected virtual void OnColorSchemeChanged(object sender, ColorSchemeChangeEventArgs e)
 
      {
 
         this.PanelColors.Clear();
 
         this.Invalidate(false);
 
         if(this.ColorSchemeChanged != null)
 
         {
 
            this.ColorSchemeChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the MouseUp event
 
      /// </summary>
 
      /// <param name="e">A MouseEventArgs that contains data about the OnMouseUp event.</param>
 
      protected override void OnMouseUp(MouseEventArgs e)
 
      {
 
         if((this.ShowExpandIcon == true) && (this.RectangleExpandIcon.Contains(e.X, e.Y) == true))
 
         {
 
            OnExpandClick(this, EventArgs.Empty);
 
         }
 
         if((this.ShowCloseIcon == true) && (this.RectangleCloseIcon.Contains(e.X, e.Y) == true))
 
         {
 
            OnCloseClick(this, EventArgs.Empty);
 
         }
 
         base.OnMouseUp(e);
 
      }
 
      /// <summary>
 
      /// Raises the MouseMove event
 
      /// </summary>
 
      /// <param name="e">A MouseEventArgs that contains the event data.</param>
 
      protected override void OnMouseMove(MouseEventArgs e)
 
      {
 
         if(this.CaptionRectangle.Contains(e.X, e.Y) == true)
 
         {
 
            if(this.m_hoverStateCaptionBar == HoverState.None)
 
            {
 
               this.m_hoverStateCaptionBar = HoverState.Hover;
 
               OnCaptionBarHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateCaptionBar));
 
            }
 
         }
 
         else
 
         {
 
            if(this.m_hoverStateCaptionBar == HoverState.Hover)
 
            {
 
               this.m_hoverStateCaptionBar = HoverState.None;
 
               OnCaptionBarHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateCaptionBar));
 
            }
 
         }
 
 
         if((this.ShowExpandIcon == true) || (this.ShowCloseIcon == true))
 
         {
 
            if(this.RectangleExpandIcon.Contains(e.X, e.Y) == true)
 
            {
 
               if(this.m_hoverStateExpandIcon == HoverState.None)
 
               {
 
                  this.m_hoverStateExpandIcon = HoverState.Hover;
 
                  OnExpandIconHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateExpandIcon));
 
               }
 
            }
 
            else
 
            {
 
               if(this.m_hoverStateExpandIcon == HoverState.Hover)
 
               {
 
                  this.m_hoverStateExpandIcon = HoverState.None;
 
                  OnExpandIconHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateExpandIcon));
 
               }
 
            }
 
            if(this.RectangleCloseIcon.Contains(e.X, e.Y) == true)
 
            {
 
               if(this.m_hoverStateCloseIcon == HoverState.None)
 
               {
 
                  this.m_hoverStateCloseIcon = HoverState.Hover;
 
                  OnCloseIconHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateCloseIcon));
 
               }
 
            }
 
            else
 
            {
 
               if(this.m_hoverStateCloseIcon == HoverState.Hover)
 
               {
 
                  this.m_hoverStateCloseIcon = HoverState.None;
 
                  OnCloseIconHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateCloseIcon));
 
               }
 
            }
 
         }
 
         base.OnMouseMove(e);
 
      }
 
      /// <summary>
 
      /// Raises the MouseLeave event.
 
      /// </summary>
 
      /// <param name="e">An EventArgs that contains the event data.</param>
 
      protected override void OnMouseLeave(EventArgs e)
 
      {
 
         if(this.m_hoverStateCaptionBar == HoverState.Hover)
 
         {
 
            this.m_hoverStateCaptionBar = HoverState.None;
 
            OnCaptionBarHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateCaptionBar));
 
         }
 
         if(this.m_hoverStateExpandIcon == HoverState.Hover)
 
         {
 
            this.m_hoverStateExpandIcon = HoverState.None;
 
            OnExpandIconHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateExpandIcon));
 
         }
 
         if(this.m_hoverStateCloseIcon == HoverState.Hover)
 
         {
 
            this.m_hoverStateCloseIcon = HoverState.None;
 
            OnCloseIconHoverStateChanged(this, new HoverStateChangeEventArgs(this.m_hoverStateCloseIcon));
 
         }
 
         base.OnMouseLeave(e);
 
      }
 
      /// <summary>
 
      /// Raises the PanelExpanding event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A XPanderStateChangeEventArgs that contains the event data.</param>
 
      protected virtual void OnPanelExpanding(object sender, XPanderStateChangeEventArgs e)
 
      {
 
         if(this.PanelExpanding != null)
 
         {
 
            this.PanelExpanding(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the PanelCollapsing event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A XPanderStateChangeEventArgs that contains the event data.</param>
 
      protected virtual void OnPanelCollapsing(object sender, XPanderStateChangeEventArgs e)
 
      {
 
         if(this.PanelCollapsing != null)
 
         {
 
            this.PanelCollapsing(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the PanelStyle changed event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A PanelStyleChangeEventArgs that contains the event data.</param>
 
      protected virtual void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
 
      {
 
         PanelStyle panelStyle = e.PanelStyle;
 
         switch(panelStyle)
 
         {
 
            case PanelStyle.Default:
 
            m_panelColors = new PanelColors(this);
 
            break;
 
            case PanelStyle.Office2007:
 
            m_panelColors = new PanelColorsOffice2007Blue(this);
 
            break;
 
         }
 
         Invalidate(true);
 
         if(this.PanelStyleChanged != null)
 
         {
 
            this.PanelStyleChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the CloseClick event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">An EventArgs that contains the event data.</param>
 
      protected virtual void OnCloseClick(object sender, EventArgs e)
 
      {
 
         if(this.CloseClick != null)
 
         {
 
            this.CloseClick(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the ExpandClick event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">An EventArgs that contains the event data.</param>
 
      protected virtual void OnExpandClick(object sender, EventArgs e)
 
      {
 
         this.Invalidate(false);
 
         if(this.ExpandClick != null)
 
         {
 
            this.ExpandClick(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the ExpandIconHoverState changed event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A HoverStateChangeEventArgs that contains the event data.</param>
 
      protected virtual void OnExpandIconHoverStateChanged(object sender, HoverStateChangeEventArgs e)
 
      {
 
         if(e.HoverState == HoverState.Hover)
 
         {
 
            if(this.Cursor != Cursors.Hand)
 
            {
 
               this.Cursor = Cursors.Hand;
 
               if(this.Expand == true)
 
               {
 
                  if(this is Panel)
 
                  {
 
                     if(string.IsNullOrEmpty(this.m_strToolTipTextExpandIconPanelExpanded) == false)
 
                     {
 
                        this.m_toolTip.SetToolTip(this, this.m_strToolTipTextExpandIconPanelExpanded);
 
                     }
 
                  }
 
               }
 
               else
 
               {
 
                  if(string.IsNullOrEmpty(this.m_strToolTipTextExpandIconPanelCollapsed) == false)
 
                  {
 
                     this.m_toolTip.SetToolTip(this, this.m_strToolTipTextExpandIconPanelCollapsed);
 
                  }
 
               }
 
            }
 
         }
 
         else
 
         {
 
            if(this.Cursor == Cursors.Hand)
 
            {
 
               this.m_toolTip.SetToolTip(this, string.Empty);
 
               this.m_toolTip.Hide(this);
 
               this.Cursor = Cursors.Default;
 
            }
 
         }
 
         if(this.ExpandIconHoverStateChanged != null)
 
         {
 
            this.ExpandIconHoverStateChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the CaptionHeight changed event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A EventArgs that contains the event data.</param>
 
      protected virtual void OnCaptionHeightChanged(object sender, EventArgs e)
 
      {
 
         OnLayout(new LayoutEventArgs(this, null));
 
         this.Invalidate(false);
 
         if(this.CaptionHeightChanged != null)
 
         {
 
            this.CaptionHeightChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the CaptionBarHoverState changed event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A HoverStateChangeEventArgs that contains the event data.</param>
 
      protected virtual void OnCaptionBarHoverStateChanged(object sender, HoverStateChangeEventArgs e)
 
      {
 
         if(this is XPanderPanel)
 
         {
 
            if(e.HoverState == HoverState.Hover)
 
            {
 
               if((this.ShowCloseIcon == false) && (this.ShowExpandIcon == false))
 
               {
 
                  if(this.Cursor != Cursors.Hand)
 
                  {
 
                     this.Cursor = Cursors.Hand;
 
                  }
 
               }
 
            }
 
            else
 
            {
 
               if(this.Cursor == Cursors.Hand)
 
               {
 
                  this.Cursor = Cursors.Default;
 
               }
 
            }
 
            this.Invalidate(CaptionRectangle);
 
         }
 
         if(this.CaptionBarHoverStateChanged != null)
 
         {
 
            this.CaptionBarHoverStateChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the CloseIconHoverState changed event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A HoverStateChangeEventArgs that contains the event data.</param>
 
      protected virtual void OnCloseIconHoverStateChanged(object sender, HoverStateChangeEventArgs e)
 
      {
 
         if(e.HoverState == HoverState.Hover)
 
         {
 
            if(this.Cursor != Cursors.Hand)
 
            {
 
               this.Cursor = Cursors.Hand;
 
            }
 
            if(string.IsNullOrEmpty(this.m_strToolTipTextCloseIcon) == false)
 
            {
 
               this.m_toolTip.SetToolTip(this, this.m_strToolTipTextCloseIcon);
 
            }
 
         }
 
         else
 
         {
 
            if(this.Cursor == Cursors.Hand)
 
            {
 
               this.m_toolTip.SetToolTip(this, string.Empty);
 
               this.m_toolTip.Hide(this);
 
               this.Cursor = Cursors.Default;
 
            }
 
         }
 
         if(this.CloseIconHoverStateChanged != null)
 
         {
 
            this.CloseIconHoverStateChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Raises the CustomColors changed event.
 
      /// </summary>
 
      /// <param name="sender">The source of the event.</param>
 
      /// <param name="e">A EventArgs that contains the event data.</param>
 
      protected virtual void OnCustomColorsChanged(object sender, EventArgs e)
 
      {
 
         if(this.ColorScheme == ColorScheme.Custom)
 
         {
 
            this.PanelColors.Clear();
 
            this.Invalidate(false);
 
         }
 
         if(this.CustomColorsChanged != null)
 
         {
 
            this.CustomColorsChanged(sender, e);
 
         }
 
      }
 
      /// <summary>
 
      /// Draws the specified text string on the specified caption surface; within the specified bounds; and in the specified font, color. 
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="layoutRectangle">Rectangle structure that specifies the location of the drawn text.</param>
 
      /// <param name="font">Font that defines the text format of the string.</param>
 
      /// <param name="fontColor">The color of the string</param>
 
      /// <param name="strText">String to draw.</param>
 
      /// <param name="rightToLeft">Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.</param>
 
      /// <param name="stringAlignment">The alignment of a text string relative to its layout rectangle.</param>
 
      protected static void DrawString(
 
          Graphics graphics,
 
          RectangleF layoutRectangle,
 
          Font font,
 
          Color fontColor,
 
          string strText,
 
          RightToLeft rightToLeft,
 
          StringAlignment stringAlignment)
 
      {
 
         if(graphics == null)
 
         {
 
            throw new ArgumentException(
 
                string.Format(
 
                System.Globalization.CultureInfo.CurrentUICulture,
 
                Resources.IDS_ArgumentException,
 
                typeof(Graphics).Name));
 
         }
 
 
         using(SolidBrush stringBrush = new SolidBrush(fontColor))
 
         {
 
            using(StringFormat stringFormat = new StringFormat())
 
            {
 
               stringFormat.FormatFlags = StringFormatFlags.NoWrap;
 
               if(rightToLeft == RightToLeft.Yes)
 
               {
 
                  stringFormat.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
 
               }
 
               stringFormat.Trimming = StringTrimming.EllipsisCharacter;
 
               stringFormat.LineAlignment = StringAlignment.Center;
 
               stringFormat.Alignment = stringAlignment;
 
               graphics.DrawString(strText, font, stringBrush, layoutRectangle, stringFormat);
 
            }
 
         }
 
      }
 
      /// <summary>
 
      /// Draws the icon image at the specified location.
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="imgPanelIcon">icon image to draw.</param>
 
      /// <param name="imageRectangle">A rectangle structure that specifies the bounds of the linear gradient.</param>
 
      /// <param name="foreColorImage">The foreground color of this image</param>
 
      /// <param name="iconPositionY">The vertical position for the icon image</param>
 
      protected static void DrawIcon(Graphics graphics, Image imgPanelIcon, Rectangle imageRectangle, Color foreColorImage, int iconPositionY)
 
      {
 
         if(graphics == null)
 
         {
 
            throw new ArgumentException(
 
                string.Format(
 
                System.Globalization.CultureInfo.CurrentUICulture,
 
                Resources.IDS_ArgumentException,
 
                typeof(Graphics).Name));
 
         }
 
         if(imgPanelIcon == null)
 
         {
 
            throw new ArgumentException(
 
                string.Format(
 
                System.Globalization.CultureInfo.CurrentUICulture,
 
                Resources.IDS_ArgumentException,
 
                typeof(Image).Name));
 
         }
 
 
         int iconPositionX = imageRectangle.Left;
 
         int iconWidth = imgPanelIcon.Width;
 
         int iconHeight = imgPanelIcon.Height;
 
 
         Rectangle rectangleIcon = new Rectangle(
 
             iconPositionX + (iconWidth / 2) - 1,
 
             iconPositionY + (iconHeight / 2) - 1,
 
             imgPanelIcon.Width,
 
             imgPanelIcon.Height - 1);
 
 
         using(System.Drawing.Imaging.ImageAttributes imageAttribute = new System.Drawing.Imaging.ImageAttributes())
 
         {
 
            imageAttribute.SetColorKey(Color.Magenta, Color.Magenta);
 
            System.Drawing.Imaging.ColorMap colorMap = new System.Drawing.Imaging.ColorMap();
 
            colorMap.OldColor = Color.FromArgb(0, 60, 166);
 
            colorMap.NewColor = foreColorImage;
 
            imageAttribute.SetRemapTable(new System.Drawing.Imaging.ColorMap[] { colorMap });
 
 
            graphics.DrawImage(imgPanelIcon, rectangleIcon, 0, 0, iconWidth, iconHeight, GraphicsUnit.Pixel, imageAttribute);
 
         }
 
      }
 
      /// <summary>
 
      /// Draws the specified Image at the specified location. 
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="image">Image to draw.</param>
 
      /// <param name="imageRectangle">Rectangle structure that specifies the location and size of the drawn image.</param>
 
      protected static void DrawImage(Graphics graphics, Image image, Rectangle imageRectangle)
 
      {
 
         if(graphics == null)
 
         {
 
            throw new ArgumentNullException(
 
                string.Format(
 
                System.Globalization.CultureInfo.CurrentUICulture,
 
                Resources.IDS_ArgumentException,
 
                typeof(Graphics).Name));
 
         }
 
         if(image != null)
 
         {
 
            graphics.DrawImage(image, imageRectangle);
 
         }
 
      }
 
      /// <summary>
 
      /// Draws the text and image objects at the specified location. 
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="captionRectangle">The drawing rectangle on a panel's caption.</param>
 
      /// <param name="iSpacing">The spacing on a panel's caption</param>
 
      /// <param name="imageRectangle">The rectangle of an image displayed on a panel's caption.</param>
 
      /// <param name="image">The image that is displayed on a panel's caption.</param>
 
      /// <param name="rightToLeft">A value indicating whether control's elements are aligned to support locales using right-to-left fonts.</param>
 
      /// <param name="fontCaption">The font of the text displayed on a panel's caption.</param>
 
      /// <param name="captionForeColor">The foreground color of the text displayed on a panel's caption.</param>
 
      /// <param name="strCaptionText">The text which is associated with this caption.</param>
 
      protected static void DrawImagesAndText(
 
         Graphics graphics,
 
         Rectangle captionRectangle,
 
         int iSpacing,
 
         Rectangle imageRectangle,
 
         Image image,
 
         RightToLeft rightToLeft,
 
         Font fontCaption,
 
         Color captionForeColor,
 
         string strCaptionText)
 
      {
 
         //DrawImages
 
         int iTextPositionX1 = iSpacing;
 
         int iTextPositionX2 = captionRectangle.Right - iSpacing;
 
 
         imageRectangle.Y = (captionRectangle.Height - imageRectangle.Height) / 2;
 
 
         if(rightToLeft == RightToLeft.No)
 
         {
 
            if(image != null)
 
            {
 
               DrawImage(graphics, image, imageRectangle);
 
               iTextPositionX1 += imageRectangle.Width + iSpacing;
 
            }
 
         }
 
         //
 
         // Draw Caption text
 
         //
 
         Rectangle textRectangle = captionRectangle;
 
         textRectangle.X = iTextPositionX1;
 
         textRectangle.Width -= iTextPositionX1 + iSpacing;
 
         if(rightToLeft == RightToLeft.Yes)
 
         {
 
            if(image != null)
 
            {
 
               Rectangle imageRectangleRight = imageRectangle;
 
               imageRectangleRight.X = iTextPositionX2 - imageRectangle.Width;
 
               DrawImage(graphics, image, imageRectangleRight);
 
               iTextPositionX2 = imageRectangleRight.X - iSpacing;
 
            }
 
         }
 
         textRectangle.Width = iTextPositionX2 - iTextPositionX1;
 
         DrawString(graphics, textRectangle, fontCaption, captionForeColor, strCaptionText, rightToLeft, StringAlignment.Near);
 
 
      }
 
      /// <summary>
 
      /// Draws the text and image objects at the specified location. 
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="captionRectangle">The drawing rectangle on a panel's caption.</param>
 
      /// <param name="iSpacing">The spacing on a panel's caption</param>
 
      /// <param name="imageRectangle">The rectangle of an image displayed on a panel's caption.</param>
 
      /// <param name="image">The image that is displayed on a panel's caption.</param>
 
      /// <param name="rightToLeft">A value indicating whether control's elements are aligned to support locales using right-to-left fonts.</param>
 
      /// <param name="bIsClosable">A value indicating whether the xpanderpanel is closable</param>
 
      /// <param name="bShowCloseIcon">A value indicating whether the close image is displayed</param>
 
      /// <param name="imageClosePanel">The close image that is displayed on a panel's caption.</param>
 
      /// <param name="foreColorCloseIcon">The foreground color of the close image that is displayed on a panel's caption.</param>
 
      /// <param name="rectangleImageClosePanel">The rectangle of the close image that is displayed on a panel's caption.</param>
 
      /// <param name="bShowExpandIcon">A value indicating whether the expand image is displayed</param>
 
      /// <param name="imageExandPanel">The expand image that is displayed on a panel's caption.</param>
 
      /// <param name="foreColorExpandIcon">The foreground color of the expand image displayed by this caption.</param>
 
      /// <param name="rectangleImageExandPanel">the rectangle of the expand image displayed by this caption.</param>
 
      /// <param name="fontCaption">The font of the text displayed on a panel's caption.</param>
 
      /// <param name="captionForeColor">The foreground color of the text displayed on a panel's caption.</param>
 
      /// <param name="strCaptionText">The text which is associated with this caption.</param>
 
      protected static void DrawImagesAndText(
 
          Graphics graphics,
 
          Rectangle captionRectangle,
 
          int iSpacing,
 
          Rectangle imageRectangle,
 
          Image image,
 
          RightToLeft rightToLeft,
 
          bool bIsClosable,
 
          bool bShowCloseIcon,
 
          Image imageClosePanel,
 
          Color foreColorCloseIcon,
 
          ref Rectangle rectangleImageClosePanel,
 
          bool bShowExpandIcon,
 
          Image imageExandPanel,
 
          Color foreColorExpandIcon,
 
          ref Rectangle rectangleImageExandPanel,
 
          Font fontCaption,
 
          Color captionForeColor,
 
          string strCaptionText)
 
      {
 
         //DrawImages
 
         int iTextPositionX1 = iSpacing;
 
         int iTextPositionX2 = captionRectangle.Right - iSpacing;
 
 
         imageRectangle.Y = (captionRectangle.Height - imageRectangle.Height) / 2;
 
 
         if(rightToLeft == RightToLeft.No)
 
         {
 
            if(image != null)
 
            {
 
               DrawImage(graphics, image, imageRectangle);
 
               iTextPositionX1 += imageRectangle.Width + iSpacing;
 
               iTextPositionX2 -= iTextPositionX1;
 
            }
 
         }
 
         else
 
         {
 
            if((bShowCloseIcon == true) && (imageClosePanel != null))
 
            {
 
               rectangleImageClosePanel = imageRectangle;
 
               rectangleImageClosePanel.X = imageRectangle.X;
 
               if(bIsClosable == true)
 
               {
 
                  DrawIcon(graphics, imageClosePanel, rectangleImageClosePanel, foreColorCloseIcon, imageRectangle.Y);
 
               }
 
               iTextPositionX1 = rectangleImageClosePanel.X + rectangleImageClosePanel.Width;
 
            }
 
            if((bShowExpandIcon == true) && (imageExandPanel != null))
 
            {
 
               rectangleImageExandPanel = imageRectangle;
 
               rectangleImageExandPanel.X = imageRectangle.X;
 
               if((bShowCloseIcon == true) && (imageClosePanel != null))
 
               {
 
                  rectangleImageExandPanel.X = iTextPositionX1 + (iSpacing / 2);
 
               }
 
               DrawIcon(graphics, imageExandPanel, rectangleImageExandPanel, foreColorExpandIcon, imageRectangle.Y);
 
               iTextPositionX1 = rectangleImageExandPanel.X + rectangleImageExandPanel.Width;
 
            }
 
         }
 
         //
 
         // Draw Caption text
 
         //
 
         RectangleF textRectangle = captionRectangle;
 
         textRectangle.X = iTextPositionX1;
 
         textRectangle.Width -= iTextPositionX1 + iSpacing;
 
         if(rightToLeft == RightToLeft.No)
 
         {
 
            if((bShowCloseIcon == true) && (imageClosePanel != null))
 
            {
 
               rectangleImageClosePanel = imageRectangle;
 
               rectangleImageClosePanel.X = captionRectangle.Right - iSpacing - imageRectangle.Width;
 
               if(bIsClosable == true)
 
               {
 
                  DrawIcon(graphics, imageClosePanel, rectangleImageClosePanel, foreColorCloseIcon, imageRectangle.Y);
 
               }
 
               iTextPositionX2 = rectangleImageClosePanel.X;
 
            }
 
            if((bShowExpandIcon == true) && (imageExandPanel != null))
 
            {
 
               rectangleImageExandPanel = imageRectangle;
 
               rectangleImageExandPanel.X = captionRectangle.Right - iSpacing - imageRectangle.Width;
 
               if((bShowCloseIcon == true) && (imageClosePanel != null))
 
               {
 
                  rectangleImageExandPanel.X = iTextPositionX2 - (iSpacing / 2) - imageRectangle.Width;
 
               }
 
               DrawIcon(graphics, imageExandPanel, rectangleImageExandPanel, foreColorExpandIcon, imageRectangle.Y);
 
               iTextPositionX2 = rectangleImageExandPanel.X;
 
            }
 
            if((bShowCloseIcon == true)
 
                    && (imageClosePanel != null)
 
                    && (bShowExpandIcon == true)
 
                    && (imageExandPanel != null))
 
            {
 
               iTextPositionX2 -= iSpacing;
 
            }
 
         }
 
         else
 
         {
 
            if(image != null)
 
            {
 
               Rectangle imageRectangleRight = imageRectangle;
 
               imageRectangleRight.X = iTextPositionX2 - imageRectangle.Width;
 
               DrawImage(graphics, image, imageRectangleRight);
 
               iTextPositionX2 = imageRectangleRight.X - iSpacing;
 
            }
 
         }
 
         textRectangle.Width = iTextPositionX2 - iTextPositionX1;
 
         textRectangle.Y = (float) (captionRectangle.Height - fontCaption.Height) / 2 + 1;
 
         textRectangle.Height = fontCaption.Height;
 
         DrawString(graphics, textRectangle, fontCaption, captionForeColor, strCaptionText, rightToLeft, StringAlignment.Near);
 
 
         //if the XPanderPanel not closable then the RectangleCloseIcon must be empty
 
         if(bIsClosable == false)
 
         {
 
            rectangleImageClosePanel = Rectangle.Empty;
 
         }
 
      }
 
      /// <summary>
 
      /// Draws the text and image objects at the specified location.
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="dockStyle">Specifies the position and manner in which a control is docked.</param>
 
      /// <param name="iSpacing">The spacing on a panel's caption</param>
 
      /// <param name="captionRectangle">The rectangle of the panel's caption bar.</param>
 
      /// <param name="panelRectangle">The rectangle that represents the client area of the panel.</param>
 
      /// <param name="imageRectangle">The rectangle of an image displayed on a panel's caption.</param>
 
      /// <param name="image">The image that is displayed on a panel's caption.</param>
 
      /// <param name="rightToLeft">A value indicating whether control's elements are aligned to support locales using right-to-left fonts.</param>
 
      /// <param name="bShowCloseIcon">A value indicating whether the close image is displayed</param>
 
      /// <param name="imageClosePanel">The close image that is displayed on a panel's caption.</param>
 
      /// <param name="foreColorCloseIcon">The foreground color of the close image that is displayed on a panel's caption.</param>
 
      /// <param name="rectangleImageClosePanel">The rectangle of the close image that is displayed on a panel's caption.</param>
 
      /// <param name="bShowExpandIcon">A value indicating whether the expand image is displayed</param>
 
      /// <param name="bIsExpanded">A value indicating whether the panel is expanded or collapsed</param>
 
      /// <param name="imageExandPanel">The expand image that is displayed on a panel's caption.</param>
 
      /// <param name="foreColorExpandPanel">The foreground color of the expand image displayed by this caption.</param>
 
      /// <param name="rectangleImageExandPanel"></param>
 
      /// <param name="fontCaption">The font of the text displayed on a panel's caption.</param>
 
      /// <param name="captionForeColor">The foreground color of the text displayed on a panel's caption.</param>
 
      /// <param name="collapsedForeColor"></param>
 
      /// <param name="strCaptionText">The text which is associated with this caption.</param>
 
      protected static void DrawImagesAndText(
 
          Graphics graphics,
 
       DockStyle dockStyle,
 
          int iSpacing,
 
          Rectangle captionRectangle,
 
       Rectangle panelRectangle,
 
          Rectangle imageRectangle,
 
       Image image,
 
       RightToLeft rightToLeft,
 
          bool bShowCloseIcon,
 
          Image imageClosePanel,
 
          Color foreColorCloseIcon,
 
          ref Rectangle rectangleImageClosePanel,
 
          bool bShowExpandIcon,
 
          bool bIsExpanded,
 
          Image imageExandPanel,
 
          Color foreColorExpandPanel,
 
          ref Rectangle rectangleImageExandPanel,
 
       Font fontCaption,
 
          Color captionForeColor,
 
          Color collapsedForeColor,
 
       string strCaptionText)
 
      {
 
         switch(dockStyle)
 
         {
 
            case DockStyle.Left:
 
            case DockStyle.Right:
 
            if(bIsExpanded == true)
 
            {
 
               DrawImagesAndText(
 
                   graphics,
 
                   captionRectangle,
 
                   iSpacing,
 
                   imageRectangle,
 
                   image,
 
                   rightToLeft,
 
                   true,
 
                   bShowCloseIcon,
 
                   imageClosePanel,
 
                   foreColorCloseIcon,
 
                   ref rectangleImageClosePanel,
 
                   bShowExpandIcon,
 
                   imageExandPanel,
 
                   foreColorExpandPanel,
 
                   ref rectangleImageExandPanel,
 
                   fontCaption,
 
                   captionForeColor,
 
                   strCaptionText);
 
            }
 
            else
 
            {
 
               rectangleImageClosePanel = Rectangle.Empty;
 
               DrawVerticalImagesAndText(
 
                   graphics,
 
            captionRectangle,
 
            panelRectangle,
 
                   imageRectangle,
 
            dockStyle,
 
            image,
 
            rightToLeft,
 
                   imageExandPanel,
 
                   foreColorExpandPanel,
 
                   ref rectangleImageExandPanel,
 
            fontCaption,
 
                   collapsedForeColor,
 
            strCaptionText);
 
            }
 
            break;
 
            case DockStyle.Top:
 
            case DockStyle.Bottom:
 
            DrawImagesAndText(
 
                graphics,
 
                captionRectangle,
 
                iSpacing,
 
                imageRectangle,
 
                image,
 
                rightToLeft,
 
                true,
 
                bShowCloseIcon,
 
                imageClosePanel,
 
                foreColorCloseIcon,
 
                ref rectangleImageClosePanel,
 
                bShowExpandIcon,
 
                imageExandPanel,
 
                foreColorExpandPanel,
 
                ref rectangleImageExandPanel,
 
                fontCaption,
 
                captionForeColor,
 
                strCaptionText);
 
            break;
 
         }
 
      }
 
      /// <summary>
 
      /// Renders the background of the caption bar
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="bounds">Rectangle structure that specifies the location of the caption bar.</param>
 
      /// <param name="beginColor">The starting color of the gradient used on the caption bar</param>
 
      /// <param name="middleColor">The middle color of the gradient used on the caption bar</param>
 
      /// <param name="endColor">The end color of the gradient used on the caption bar</param>
 
      /// <param name="linearGradientMode">Specifies the type of fill a Pen object uses to fill lines.</param>
 
      /// <param name="flipHorizontal"></param>
 
      protected static void RenderDoubleBackgroundGradient(Graphics graphics, Rectangle bounds, Color beginColor, Color middleColor, Color endColor, LinearGradientMode linearGradientMode, bool flipHorizontal)
 
      {
 
         int iUpperHeight = bounds.Height / 2;
 
         int iLowerHeight = bounds.Height - iUpperHeight;
 
 
         RenderDoubleBackgroundGradient(
 
         graphics,
 
         bounds,
 
         beginColor,
 
         middleColor,
 
         endColor,
 
         iUpperHeight,
 
         iLowerHeight,
 
         linearGradientMode,
 
         flipHorizontal);
 
      }
 
      /// <summary>
 
      /// Renders the panel background
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="bounds">Rectangle structure that specifies the backgrounds location.</param>
 
      /// <param name="beginColor">The starting color of the gradient used on the panel background</param>
 
      /// <param name="endColor">The end color of the gradient used on the panel background</param>
 
      /// <param name="linearGradientMode">Specifies the type of fill a Pen object uses to fill lines.</param>
 
      protected static void RenderBackgroundGradient(Graphics graphics, Rectangle bounds, Color beginColor, Color endColor, LinearGradientMode linearGradientMode)
 
      {
 
         if(graphics == null)
 
         {
 
            throw new ArgumentException(
 
                string.Format(
 
                System.Globalization.CultureInfo.CurrentUICulture,
 
                Resources.IDS_ArgumentException,
 
                typeof(Graphics).Name));
 
         }
 
         if(IsZeroWidthOrHeight(bounds))
 
         {
 
            return;
 
         }
 
         using(LinearGradientBrush linearGradientBrush = new LinearGradientBrush(bounds, beginColor, endColor, linearGradientMode))
 
         {
 
            graphics.FillRectangle(linearGradientBrush, bounds);
 
         }
 
      }
 
      /// <summary>
 
      /// Renders the button background
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="bounds">Rectangle structure that specifies the backgrounds location.</param>
 
      /// <param name="colorGradientBegin">The starting color of the gradient used on the button background</param>
 
      /// <param name="colorGradientMiddle">The middle color of the gradient used on the button background</param>
 
      /// <param name="colorGradientEnd">The end color of the gradient used on the button background</param>
 
      protected static void RenderButtonBackground(Graphics graphics, Rectangle bounds, Color colorGradientBegin, Color colorGradientMiddle, Color colorGradientEnd)
 
      {
 
         RectangleF upperRectangle = bounds;
 
         upperRectangle.Height = bounds.Height * 0.4f;
 
 
         using(LinearGradientBrush upperLinearGradientBrush = new LinearGradientBrush(
 
                 upperRectangle,
 
                 colorGradientBegin,
 
                 colorGradientMiddle,
 
                 LinearGradientMode.Vertical))
 
         {
 
            if(upperLinearGradientBrush != null)
 
            {
 
               Blend blend = new Blend();
 
               blend.Positions = new float[] { 0.0F, 1.0F };
 
               blend.Factors = new float[] { 0.0F, 0.6F };
 
               upperLinearGradientBrush.Blend = blend;
 
               graphics.FillRectangle(upperLinearGradientBrush, upperRectangle);
 
            }
 
         }
 
 
         RectangleF lowerRectangle = bounds;
 
         lowerRectangle.Y = upperRectangle.Height;
 
         lowerRectangle.Height = bounds.Height - upperRectangle.Height;
 
 
         using(LinearGradientBrush lowerLinearGradientBrush = new LinearGradientBrush(
 
                 lowerRectangle,
 
                 colorGradientMiddle,
 
                 colorGradientEnd,
 
                 LinearGradientMode.Vertical))
 
         {
 
            if(lowerLinearGradientBrush != null)
 
            {
 
               graphics.FillRectangle(lowerLinearGradientBrush, lowerRectangle);
 
            }
 
         }
 
         //At some captionheights there are drawing errors. This is the correction
 
         RectangleF correctionRectangle = lowerRectangle;
 
         correctionRectangle.Y -= 1;
 
         correctionRectangle.Height = 2;
 
         using(SolidBrush solidBrush = new SolidBrush(colorGradientMiddle))
 
         {
 
            graphics.FillRectangle(solidBrush, correctionRectangle);
 
         }
 
      }
 
      /// <summary>
 
      /// Renders the flat button background
 
      /// </summary>
 
      /// <param name="graphics">The Graphics to draw on.</param>
 
      /// <param name="bounds">Rectangle structure that specifies the backgrounds location.</param>
 
      /// <param name="colorGradientBegin">The starting color of the gradient used on the button background</param>
 
      /// <param name="colorGradientEnd">The end color of the gradient used on the button background</param>
 
      /// <param name="bHover">A indicator that represents when the mouse cursor hovers over</param>
 
      protected static void RenderFlatButtonBackground(Graphics graphics, Rectangle bounds, Color colorGradientBegin, Color colorGradientEnd, bool bHover)
 
      {
 
         using(LinearGradientBrush gradientBrush = GetFlatGradientBackBrush(bounds, colorGradientBegin, colorGradientEnd, bHover))
 
         {
 
            if(gradientBrush != null)
 
            {
 
               graphics.FillRectangle(gradientBrush, bounds);
 
            }
 
         }
 
      }
 
 
      /// <summary>
 
      /// Gets a GraphicsPath. 
 
      /// </summary>
 
      /// <param name="bounds">Rectangle structure that specifies the backgrounds location.</param>
 
      /// <param name="radius">The radius in the graphics path</param>
 
      /// <returns>the specified graphics path</returns>
 
      protected static GraphicsPath GetPath(Rectangle bounds, int radius)
 
      {
 
         int x = bounds.X;
 
         int y = bounds.Y;
 
         int width = bounds.Width;
 
         int height = bounds.Height;
 
         GraphicsPath graphicsPath = new GraphicsPath();
 
         graphicsPath.AddArc(x, y, radius, radius, 180, 90);				                    //Upper left corner
 
         graphicsPath.AddArc(x + width - radius, y, radius, radius, 270, 90);			    //Upper right corner
 
         graphicsPath.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);//Lower right corner
 
         graphicsPath.AddArc(x, y + height - radius, radius, radius, 90, 90);			                    //Lower left corner
 
         graphicsPath.CloseFigure();
 
         return graphicsPath;
 
      }
 
      /// <summary>
 
      /// Gets a GraphicsPath with rounded corners on the upper side.
 
      /// </summary>
 
      /// <param name="bounds">Rectangle structure that specifies the backgrounds location.</param>
 
      /// <param name="radius">The radius in the graphics path</param>
 
      /// <returns>the specified graphics path</returns>
 
      protected static GraphicsPath GetUpperBackgroundPath(Rectangle bounds, int radius)
 
      {
 
         int x = bounds.X;
 
         int y = bounds.Y;
 
         int width = bounds.Width;
 
         int height = bounds.Height;
 
         GraphicsPath graphicsPath = new GraphicsPath();
 
         graphicsPath.AddLine(x, y + height, x, y - radius);                 //Left Line
 
         graphicsPath.AddArc(x, y, radius, radius, 180, 90);                 //Upper left corner
 
         graphicsPath.AddArc(x + width - radius, y, radius, radius, 270, 90);//Upper right corner
 
         graphicsPath.AddLine(x + width, y + radius, x + width, y + height); //Right Line
 
         graphicsPath.CloseFigure();
 
         return graphicsPath;
 
      }
 
      /// <summary>
 
      /// Gets a GraphicsPath.
 
      /// </summary>
 
      /// <param name="bounds">Rectangle structure that specifies the backgrounds location.</param>
 
      /// <param name="radius">The radius in the graphics path</param>
 
      /// <returns>The specified graphics path</returns>
 
      protected static GraphicsPath GetBackgroundPath(Rectangle bounds, int radius)
 
      {
 
         int x = bounds.X;
 
         int y = bounds.Y;
 
         int width = bounds.Width;
 
         int height = bounds.Height;
 
         GraphicsPath graphicsPath = new GraphicsPath();
 
         graphicsPath.AddArc(x, y, radius, radius, 180, 90);				                    //Upper left corner
 
         graphicsPath.AddArc(x + width - radius, y, radius, radius, 270, 90);			    //Upper right corner
 
         graphicsPath.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);//Lower right corner
 
         graphicsPath.AddArc(x, y + height - radius, radius, radius, 90, 90);			    //Lower left corner
 
         graphicsPath.CloseFigure();
 
         return graphicsPath;
 
      }
 
      /// <summary>
 
      /// Gets the linear GradientBackBrush for flat XPanderPanel captions.
 
      /// </summary>
 
      /// <param name="bounds">Rectangle structure that specifies the bounds of the linear gradient.</param>
 
      /// <param name="colorGradientBegin">A Color structure that represents the starting color for the gradient.</param>
 
      /// <param name="colorGradientEnd">A Color structure that represents the end color for the gradient.</param>
 
      /// <param name="bHover">A indicator that represents when the mouse cursor hovers over</param>
 
      /// <returns></returns>
 
      protected static LinearGradientBrush GetFlatGradientBackBrush(Rectangle bounds, Color colorGradientBegin, Color colorGradientEnd, bool bHover)
 
      {
 
         LinearGradientBrush linearGradientBrush = null;
 
         Blend blend = new Blend();
 
         blend.Positions = new float[] { 0.0F, 0.2F, 0.3F, 0.4F, 0.5F, 0.6F, 0.7F, 0.8F, 1.0F };
 
         if(bHover == false)
 
         {
 
            blend.Factors = new float[] { 0.0F, 0.0F, 0.2F, 0.4F, 0.6F, 0.4F, 0.2F, 0.0F, 0.0F };
 
         }
 
         else
 
         {
 
            blend.Factors = new float[] { 0.4F, 0.5F, 0.6F, 0.8F, 1.0F, 0.8F, 0.6F, 0.5F, 0.4F };
 
         }
 
         linearGradientBrush = linearGradientBrush = new LinearGradientBrush(bounds, colorGradientBegin, colorGradientEnd, LinearGradientMode.Horizontal);
 
         if(linearGradientBrush != null)
 
         {
 
            linearGradientBrush.Blend = blend;
 
         }
 
         return linearGradientBrush;
 
      }
 
      /// <summary>
 
      /// Checks if the rectangle width or height is equal to 0.
 
      /// </summary>
 
      /// <param name="rectangle">the rectangle to check</param>
 
      /// <returns>true if the with or height of the rectangle is 0 else false</returns>
 
      protected static bool IsZeroWidthOrHeight(Rectangle rectangle)
 
      {
 
         if(rectangle.Width != 0)
 
         {
 
            return (rectangle.Height == 0);
 
         }
 
         return true;
 
      }
 
      #endregion
 
 
      #region MethodsPrivate
 
 
      private static void RenderDoubleBackgroundGradient(Graphics graphics, Rectangle bounds, Color beginColor, Color middleColor, Color endColor, int firstGradientWidth, int secondGradientWidth, LinearGradientMode mode, bool flipHorizontal)
 
      {
 
         if((bounds.Width != 0) && (bounds.Height != 0))
 
         {
 
            Rectangle rectangle1 = bounds;
 
            Rectangle rectangle2 = bounds;
 
            bool flag1 = true;
 
            if(mode == LinearGradientMode.Horizontal)
 
            {
 
               if(flipHorizontal)
 
               {
 
                  Color color1 = endColor;
 
                  endColor = beginColor;
 
                  beginColor = color1;
 
               }
 
               rectangle2.Width = firstGradientWidth;
 
               rectangle1.Width = secondGradientWidth + 1;
 
               rectangle1.X = bounds.Right - rectangle1.Width;
 
               flag1 = bounds.Width > (firstGradientWidth + secondGradientWidth);
 
            }
 
            else
 
            {
 
               rectangle2.Height = firstGradientWidth;
 
               rectangle1.Height = secondGradientWidth + 1;
 
               rectangle1.Y = bounds.Bottom - rectangle1.Height;
 
               flag1 = bounds.Height > (firstGradientWidth + secondGradientWidth);
 
            }
 
            if(flag1)
 
            {
 
               using(Brush brush1 = new SolidBrush(middleColor))
 
               {
 
                  graphics.FillRectangle(brush1, bounds);
 
               }
 
               using(Brush brush2 = new LinearGradientBrush(rectangle2, beginColor, middleColor, mode))
 
               {
 
                  graphics.FillRectangle(brush2, rectangle2);
 
               }
 
               using(LinearGradientBrush brush3 = new LinearGradientBrush(rectangle1, middleColor, endColor, mode))
 
               {
 
                  if(mode == LinearGradientMode.Horizontal)
 
                  {
 
                     rectangle1.X++;
 
                     rectangle1.Width--;
 
                  }
 
                  else
 
                  {
 
                     rectangle1.Y++;
 
                     rectangle1.Height--;
 
                  }
 
                  graphics.FillRectangle(brush3, rectangle1);
 
                  return;
 
               }
 
            }
 
            using(Brush brush4 = new LinearGradientBrush(bounds, beginColor, endColor, mode))
 
            {
 
               graphics.FillRectangle(brush4, bounds);
 
            }
 
         }
 
      }
 
 
      private static void DrawVerticalImagesAndText(
 
          Graphics graphics,
 
       Rectangle captionRectangle,
 
       Rectangle panelRectangle,
 
          Rectangle imageRectangle,
 
       DockStyle dockStyle,
 
       Image image,
 
       RightToLeft rightToLeft,
 
          Image imageExandPanel,
 
          Color foreColorExpandPanel,
 
          ref Rectangle rectangleImageExandPanel,
 
       Font captionFont,
 
       Color collapsedCaptionForeColor,
 
       string strCaptionText)
 
      {
 
         imageRectangle.Y = (captionRectangle.Height - imageRectangle.Height) / 2;
 
 
         if(imageExandPanel != null)
 
         {
 
            rectangleImageExandPanel = imageRectangle;
 
            rectangleImageExandPanel.X = (panelRectangle.Width - imageRectangle.Width) / 2;
 
            DrawIcon(graphics, imageExandPanel, rectangleImageExandPanel, foreColorExpandPanel, imageRectangle.Y);
 
         }
 
 
         int iTextPositionY1 = CaptionSpacing;
 
         int iTextPositionY2 = panelRectangle.Height - CaptionSpacing;
 
 
         if(image != null)
 
         {
 
            imageRectangle.Y = iTextPositionY2 - imageRectangle.Height;
 
            imageRectangle.X = (panelRectangle.Width - imageRectangle.Width) / 2;
 
            DrawImage(graphics, image, imageRectangle);
 
            iTextPositionY1 += imageRectangle.Height + CaptionSpacing;
 
         }
 
 
         iTextPositionY2 -= captionRectangle.Height + iTextPositionY1;
 
 
         Rectangle textRectangle = new Rectangle(
 
             iTextPositionY1,
 
         panelRectangle.Y,
 
             iTextPositionY2,
 
         captionRectangle.Height);
 
 
         using(SolidBrush textBrush = new SolidBrush(collapsedCaptionForeColor))
 
         {
 
            if(dockStyle == DockStyle.Left)
 
            {
 
               graphics.TranslateTransform(0, panelRectangle.Height);
 
               graphics.RotateTransform(-90);
 
 
               DrawString(
 
                   graphics,
 
                   textRectangle,
 
             captionFont,
 
                   collapsedCaptionForeColor,
 
             strCaptionText,
 
             rightToLeft,
 
                   StringAlignment.Center);
 
 
               graphics.ResetTransform();
 
            }
 
            if(dockStyle == DockStyle.Right)
 
            {
 
               graphics.TranslateTransform(panelRectangle.Width, 0);
 
               graphics.RotateTransform(90);
 
 
               DrawString(
 
                   graphics,
 
                   textRectangle,
 
             captionFont,
 
                   collapsedCaptionForeColor,
 
             strCaptionText,
 
             rightToLeft,
 
                   StringAlignment.Center);
 
 
               graphics.ResetTransform();
 
            }
 
         }
 
      }
 
      #endregion
 
   }
 
}
Demo.WindowsForms/BSE.Windows.Forms/XPander/CaptionStyle.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
namespace BSE.Windows.Forms
 
{
 
	/// <summary>
 
	/// Specifies constants that define the style of the caption in a XPanderPanel.
 
	/// </summary>
 
    /// <copyright>Copyright © 2008 Uwe Eichkorn
 
    /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
    /// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
    /// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
    /// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
    /// REMAINS UNCHANGED.
 
    /// </copyright>
 
	public enum CaptionStyle
 
	{
 
		/// <summary>
 
		///  The normal style of a caption.
 
		/// </summary>
 
		Normal,
 
		/// <summary>
 
		/// The flat style of a caption.
 
		/// </summary>
 
		Flat
 
	}
 
}
Demo.WindowsForms/BSE.Windows.Forms/XPander/ColorScheme.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
	/// Contains information for the drawing of panels or xpanderpanels in a xpanderpanellist. 
 
    /// </summary>
 
	/// <copyright>Copyright © 2006-2008 Uwe Eichkorn
 
    /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
    /// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
    /// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
    /// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
    /// REMAINS UNCHANGED.
 
    /// </copyright>
 
	public enum ColorScheme
 
    {
 
        /// <summary>
 
        /// Draws the panels caption with <see cref="System.Windows.Forms.ProfessionalColors">ProfessionalColors</see>
 
        /// </summary>
 
		Professional,
 
        /// <summary>
 
        /// Draws the panels caption with custom colors.
 
        /// </summary>
 
		Custom
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/XPander/ColorSchemeChangeEventArgs.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
namespace BSE.Windows.Forms
 
{
 
    /// <summary>
 
    /// Provides data for the ColorSchemeChange event.
 
    /// </summary>
 
    /// <copyright>Copyright © 2006-2008 Uwe Eichkorn
 
    /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
    /// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
    /// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
    /// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
    /// REMAINS UNCHANGED.
 
    /// </copyright>
 
    public class ColorSchemeChangeEventArgs : EventArgs
 
    {
 
        #region FieldsPrivate
 
 
        private ColorScheme m_eColorSchema;
 
 
        #endregion
 
 
        #region Properties
 
        /// <summary>
 
        /// Gets the color schema which is used for the panel.
 
        /// </summary>
 
        public ColorScheme ColorSchema
 
        {
 
            get { return this.m_eColorSchema; }
 
        }
 
        #endregion
 
 
        #region MethodsPublic
 
        /// <summary>
 
        /// Arguments used when a ColorSchemeChange event occurs.
 
        /// </summary>
 
        /// <param name="eColorSchema">The color schema which is used for the panel.</param>
 
        public ColorSchemeChangeEventArgs(ColorScheme eColorSchema)
 
        {
 
            this.m_eColorSchema = eColorSchema;
 
        }
 
 
        #endregion
 
    }
 
}
Demo.WindowsForms/BSE.Windows.Forms/XPander/Constants.cs
Show inline comments
 
new file 100644
 
using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
namespace BSE.Windows.Forms
 
{
 
	/// <summary>
 
	/// Contains the constants for the XPanderControls
 
	/// </summary>
 
    public static class Constants
 
	{
 
		/// <summary>
 
		/// The minimum height for the captionbars in the panels
 
		/// </summary>
 
		public const int CaptionMinHeight = 18;
 
        /// <summary>
 
        /// Gets the thickness, in pixels, of a flat-style control border.
 
        /// </summary>
 
        public const int BorderThickness = 1;
 
	}
 
}

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)