tools/Stampfer/PeterSource1_1/DockContent/VistaButton.cs
/// <summary>
/// Draws the image for the button
/// </summary>
/// <param name="g">The graphics object used in the paint event.</param>
Draws the image for the button
Draws the image for the button
private void DrawImage (Graphics g)
        {
            if (this.Image == null) { return; }
            Rectangle r = new Rectangle(8, 8, this.ImageSize.Width, this.ImageSize.Height);
            switch (this.ImageAlign)
            {
                case ContentAlignment.TopCenter:
                    r = new Rectangle(this.Width / 2 - this.ImageSize.Width / 2, 8, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.TopRight:
                    r = new Rectangle(this.Width - 8 - this.ImageSize.Width, 8, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.MiddleLeft:
                    r = new Rectangle(8, this.Height / 2 - this.ImageSize.Height / 2, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.MiddleCenter:
                    r = new Rectangle(this.Width / 2 - this.ImageSize.Width / 2, this.Height / 2 - this.ImageSize.Height / 2, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.MiddleRight:
                    r = new Rectangle(this.Width - 8 - this.ImageSize.Width, this.Height / 2 - this.ImageSize.Height / 2, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.BottomLeft:
                    r = new Rectangle(8, this.Height - 8 - this.ImageSize.Height, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.BottomCenter:
                    r = new Rectangle(this.Width / 2 - this.ImageSize.Width / 2, this.Height - 8 - this.ImageSize.Height, this.ImageSize.Width, this.ImageSize.Height);
                    break;
                case ContentAlignment.BottomRight:
                    r = new Rectangle(this.Width - 8 - this.ImageSize.Width, this.Height - 8 - this.ImageSize.Height, this.ImageSize.Width, this.ImageSize.Height);
                    break;
            }
            g.DrawImage(this.Image, r);
        }
private void DrawImage ( Graphics g ) { if ( this . Image == null ) { return ; } Rectangle r = new Rectangle ( 8 , 8 , this . ImageSize . Width , this . ImageSize . Height ) ; switch ( this . ImageAlign ) { case ContentAlignment . TopCenter : r = new Rectangle ( this . Width / 2 - this . ImageSize . Width / 2 , 8 , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . TopRight : r = new Rectangle ( this . Width - 8 - this . ImageSize . Width , 8 , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . MiddleLeft : r = new Rectangle ( 8 , this . Height / 2 - this . ImageSize . Height / 2 , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . MiddleCenter : r = new Rectangle ( this . Width / 2 - this . ImageSize . Width / 2 , this . Height / 2 - this . ImageSize . Height / 2 , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . MiddleRight : r = new Rectangle ( this . Width - 8 - this . ImageSize . Width , this . Height / 2 - this . ImageSize . Height / 2 , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . BottomLeft : r = new Rectangle ( 8 , this . Height - 8 - this . ImageSize . Height , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . BottomCenter : r = new Rectangle ( this . Width / 2 - this . ImageSize . Width / 2 , this . Height - 8 - this . ImageSize . Height , this . ImageSize . Width , this . ImageSize . Height ) ; break ; case ContentAlignment . BottomRight : r = new Rectangle ( this . Width - 8 - this . ImageSize . Width , this . Height - 8 - this . ImageSize . Height , this . ImageSize . Width , this . ImageSize . Height ) ; break ; } g . DrawImage ( this . Image , r ) ; }
Draws the image for the button
Draws the image for the button
g
Graphics
The graphics object used in the paint event.
The graphics object used in the paint event .