tools/Stampfer/PeterSource1_1/DockContent/VistaButton.cs
/// <summary>
/// Draws the background for the control
/// using the background image and the 
/// BaseColor.
/// </summary>
/// <param name="g">The graphics object used in the paint event.</param>
Draws the background for the control
using the background image and the
BaseColor.
Draws the background for the control using the background image and the BaseColor .
private void DrawBackground (Graphics g)
        {
            if (this.ButtonStyle == Style.Flat && this.mButtonState == State.None) { return; }
            int alpha = (mButtonState == State.Pressed) ? 204 : 127;
            Rectangle r = this.ClientRectangle;
            r.Width--; r.Height--;
            using (GraphicsPath rr = RoundRect(r, CornerRadius, CornerRadius, CornerRadius, CornerRadius))
            {
                using (SolidBrush sb = new SolidBrush(this.BaseColor))
                {
                    g.FillPath(sb, rr);
                }
                SetClip(g);
                if (this.BackImage != null)
                {
                    g.DrawImage(this.BackImage, new Rectangle((this.Width / 2) - (this.BackImage.Width / 2),
                        (this.Height / 2) - (this.BackImage.Height / 2), this.BackImage.Width, this.BackImage.Height));
                }
                g.ResetClip();
                using (SolidBrush sb = new SolidBrush(Color.FromArgb(alpha, this.ButtonColor)))
                {
                    g.FillPath(sb, rr);
                }
            }
        }
private void DrawBackground ( Graphics g ) { if ( this . ButtonStyle == Style . Flat && this . mButtonState == State . None ) { return ; } int alpha = ( mButtonState == State . Pressed ) ? 204 : 127 ; Rectangle r = this . ClientRectangle ; r . Width -- ; r . Height -- ; using ( GraphicsPath rr = RoundRect ( r , CornerRadius , CornerRadius , CornerRadius , CornerRadius ) ) { using ( SolidBrush sb = new SolidBrush ( this . BaseColor ) ) { g . FillPath ( sb , rr ) ; } SetClip ( g ) ; if ( this . BackImage != null ) { g . DrawImage ( this . BackImage , new Rectangle ( ( this . Width / 2 ) - ( this . BackImage . Width / 2 ) , ( this . Height / 2 ) - ( this . BackImage . Height / 2 ) , this . BackImage . Width , this . BackImage . Height ) ) ; } g . ResetClip ( ) ; using ( SolidBrush sb = new SolidBrush ( Color . FromArgb ( alpha , this . ButtonColor ) ) ) { g . FillPath ( sb , rr ) ; } } }
Draws the background for the control
using the background image and the
BaseColor.
Draws the background for the control using the background image and the BaseColor .
g
Graphics
The graphics object used in the paint event.
The graphics object used in the paint event .