All pastes #235008 Raw Edit

Stuff

public text v1 · immutable
·published 2006-11-02 23:07 UTC
rendered paste body
        protected override void OnPaint( PaintEventArgs e )
        {
            base.OnPaint( e );

            if( _FileUtility == null )
                return;

            e.Graphics.DrawString( GetCurrentStatString(), Font, Brushes.LightSteelBlue, new PointF( 10, 10 ) );

            int width = Width - 20;
            int height = 20;

            Rectangle fileBar = new Rectangle( 10, 150, width, height );
            Rectangle totalBar = new Rectangle( 10, 175, width, height );

            int fileFillLength = ( int )( ( double )( _FileUtility.Percent * .01 ) * width );
            int totalFillLength = ( int )( ( double )( _FileUtility.TotalPercent * .01 ) * width );

            Rectangle fileFillBar = new Rectangle(10, 150, fileFillLength, height );
            Rectangle totalFillBar = new Rectangle(10, 150, totalFillLength, height );


            e.Graphics.FillRectangle( Brushes.LightSlateGray, fileFillBar );
            e.Graphics.FillRectangle( Brushes.LightSlateGray, totalFillBar );
            e.Graphics.DrawRectangle( _Pen, fileBar );
            e.Graphics.DrawRectangle( _Pen, totalBar );

            e.Graphics.DrawString( _FileUtility.Percent.ToString(), Font, Brushes.Black, new PointF( 10 + fileFillLength - e.Graphics.MeasureString( _FileUtility.Percent.ToString(), Font ).Width, 150 ) );
            e.Graphics.DrawString( _FileUtility.Percent.ToString(), Font, Brushes.Black, new PointF( 10 + totalFillLength - e.Graphics.MeasureString( _FileUtility.TotalPercent.ToString(), Font ).Width, 175 ) );
        }