tools/Stampfer/PeterSource1_1/Controls/Grouper.cs
/// <summary>This method will paint the control.</summary>
/// <param name="g">The paint event graphics object.</param>
This method will paint the control.
This method will paint the control .
private void PaintBack (System.Drawing.Graphics g)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;
            int ArcWidth = this.RoundCorners * 2;
            int ArcHeight = this.RoundCorners * 2;
            int ArcX1 = 0;
            int ArcX2 = (this.ShadowControl) ? (this.Width - (ArcWidth + 1)) - this.ShadowThickness : this.Width - (ArcWidth + 1);
            int ArcY1 = 10;
            int ArcY2 = (this.ShadowControl) ? (this.Height - (ArcHeight + 1)) - this.ShadowThickness : this.Height - (ArcHeight + 1);
            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush = new SolidBrush(this.BorderColor);
            System.Drawing.Pen BorderPen = new Pen(BorderBrush, this.BorderThickness);
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush BackgroundBrush = new SolidBrush(this.BackgroundColor);
            System.Drawing.SolidBrush ShadowBrush = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath = null;
            if (this.ShadowControl)
            {
                ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 180, Grouper.SweepAngle); 
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 270, Grouper.SweepAngle); 
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 360, Grouper.SweepAngle); 
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 90, Grouper.SweepAngle); 
                ShadowPath.CloseAllFigures();
                g.FillPath(ShadowBrush, ShadowPath);
            }
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, Grouper.SweepAngle); 
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, Grouper.SweepAngle); 
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, Grouper.SweepAngle); 
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, Grouper.SweepAngle); 
            path.CloseAllFigures();
            if (this.BackgroundGradientMode == GroupBoxGradientMode.None)
            {
                g.FillPath(BackgroundBrush, path);
            }
            else
            {
                BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.BackgroundColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);
                g.FillPath(BackgroundGradientBrush, path);
            }
            g.DrawPath(BorderPen, path);
            if (path != null) { path.Dispose(); }
            if (BorderBrush != null) { BorderBrush.Dispose(); }
            if (BorderPen != null) { BorderPen.Dispose(); }
            if (BackgroundGradientBrush != null) { BackgroundGradientBrush.Dispose(); }
            if (BackgroundBrush != null) { BackgroundBrush.Dispose(); }
            if (ShadowBrush != null) { ShadowBrush.Dispose(); }
            if (ShadowPath != null) { ShadowPath.Dispose(); }
        }
private void PaintBack ( System . Drawing . Graphics g ) { g . SmoothingMode = SmoothingMode . AntiAlias ; int ArcWidth = this . RoundCorners * 2 ; int ArcHeight = this . RoundCorners * 2 ; int ArcX1 = 0 ; int ArcX2 = ( this . ShadowControl ) ? ( this . Width - ( ArcWidth + 1 ) ) - this . ShadowThickness : this . Width - ( ArcWidth + 1 ) ; int ArcY1 = 10 ; int ArcY2 = ( this . ShadowControl ) ? ( this . Height - ( ArcHeight + 1 ) ) - this . ShadowThickness : this . Height - ( ArcHeight + 1 ) ; System . Drawing . Drawing2D . GraphicsPath path = new System . Drawing . Drawing2D . GraphicsPath ( ) ; System . Drawing . Brush BorderBrush = new SolidBrush ( this . BorderColor ) ; System . Drawing . Pen BorderPen = new Pen ( BorderBrush , this . BorderThickness ) ; System . Drawing . Drawing2D . LinearGradientBrush BackgroundGradientBrush = null ; System . Drawing . Brush BackgroundBrush = new SolidBrush ( this . BackgroundColor ) ; System . Drawing . SolidBrush ShadowBrush = null ; System . Drawing . Drawing2D . GraphicsPath ShadowPath = null ; if ( this . ShadowControl ) { ShadowBrush = new SolidBrush ( this . ShadowColor ) ; ShadowPath = new System . Drawing . Drawing2D . GraphicsPath ( ) ; ShadowPath . AddArc ( ArcX1 + this . ShadowThickness , ArcY1 + this . ShadowThickness , ArcWidth , ArcHeight , 180 , Grouper . SweepAngle ) ; ShadowPath . AddArc ( ArcX2 + this . ShadowThickness , ArcY1 + this . ShadowThickness , ArcWidth , ArcHeight , 270 , Grouper . SweepAngle ) ; ShadowPath . AddArc ( ArcX2 + this . ShadowThickness , ArcY2 + this . ShadowThickness , ArcWidth , ArcHeight , 360 , Grouper . SweepAngle ) ; ShadowPath . AddArc ( ArcX1 + this . ShadowThickness , ArcY2 + this . ShadowThickness , ArcWidth , ArcHeight , 90 , Grouper . SweepAngle ) ; ShadowPath . CloseAllFigures ( ) ; g . FillPath ( ShadowBrush , ShadowPath ) ; } path . AddArc ( ArcX1 , ArcY1 , ArcWidth , ArcHeight , 180 , Grouper . SweepAngle ) ; path . AddArc ( ArcX2 , ArcY1 , ArcWidth , ArcHeight , 270 , Grouper . SweepAngle ) ; path . AddArc ( ArcX2 , ArcY2 , ArcWidth , ArcHeight , 360 , Grouper . SweepAngle ) ; path . AddArc ( ArcX1 , ArcY2 , ArcWidth , ArcHeight , 90 , Grouper . SweepAngle ) ; path . CloseAllFigures ( ) ; if ( this . BackgroundGradientMode == GroupBoxGradientMode . None ) { g . FillPath ( BackgroundBrush , path ) ; } else { BackgroundGradientBrush = new LinearGradientBrush ( new Rectangle ( 0 , 0 , this . Width , this . Height ) , this . BackgroundColor , this . BackgroundGradientColor , ( LinearGradientMode ) this . BackgroundGradientMode ) ; g . FillPath ( BackgroundGradientBrush , path ) ; } g . DrawPath ( BorderPen , path ) ; if ( path != null ) { path . Dispose ( ) ; } if ( BorderBrush != null ) { BorderBrush . Dispose ( ) ; } if ( BorderPen != null ) { BorderPen . Dispose ( ) ; } if ( BackgroundGradientBrush != null ) { BackgroundGradientBrush . Dispose ( ) ; } if ( BackgroundBrush != null ) { BackgroundBrush . Dispose ( ) ; } if ( ShadowBrush != null ) { ShadowBrush . Dispose ( ) ; } if ( ShadowPath != null ) { ShadowPath . Dispose ( ) ; } }
This method will paint the control.
This method will paint the control .
//Set Graphics smoothing mode to Anit-Alias--  //------------------------------------------- //Declare Variables------------------ //----------------------------------- //Check if shadow is needed---------- // Top Left //Top Right //Bottom Right //Bottom Left //Paint Rounded Rectangle------------ //----------------------------------- //----------------------------------- //Create Rounded Rectangle Path------ // Top Left //Top Right //Bottom Right //Bottom Left //----------------------------------- //Check if Gradient Mode is enabled-- //Paint Rounded Rectangle------------ //----------------------------------- //Paint Rounded Rectangle------------ //----------------------------------- //----------------------------------- //Paint Borded----------------------- //----------------------------------- //Destroy Graphic Objects------------ //-----------------------------------
g
System.Drawing.Graphics
The paint event graphics object.
The paint event graphics object .