Nuaj.Cirrus.Utility.IntegerTrackbarControl.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaint( PaintEventArgs e )
        {
            base.OnPaint( e );

            // Draw the slider
            float	fSizeToDraw = m_SliderRectangle.Width * (Value - VisibleRangeMin) / Math.Max( 1, VisibleRangeMax - VisibleRangeMin );
            e.Graphics.FillRectangle( Enabled ? m_BackgroundBrush : m_BackgroundBrushDisabled, m_SliderRectangle.X + fSizeToDraw, m_SliderRectangle.Y, m_SliderRectangle.Width - fSizeToDraw, m_SliderRectangle.Height );
            e.Graphics.FillRectangle( m_SliderBrush, m_SliderRectangle.X, m_SliderRectangle.Y, fSizeToDraw, m_SliderRectangle.Height );

            // Draw the left image portion
            e.Graphics.DrawImage( Properties.Resources.Trackbar___Left, 0, 0, Properties.Resources.Trackbar___Left.Width, Properties.Resources.Trackbar___Left.Height );

            // Draw the middle image portion
            int		DrawLeft = Properties.Resources.Trackbar___Left.Width;
            int		DrawRight = Width - Properties.Resources.Trackbar___Right.Width;
            e.Graphics.FillRectangle( m_BrushTrackbarMiddle, DrawLeft, 0, DrawRight - DrawLeft, Properties.Resources.Trackbar___Middle.Height );

            // Draw the right image portion
            e.Graphics.DrawImage( Properties.Resources.Trackbar___Right, DrawRight, 0, Properties.Resources.Trackbar___Right.Width, Properties.Resources.Trackbar___Right.Height );
        }