AlbedoDatabaseGenerator.TexturePanel.OnPaint C# (CSharp) Метод

OnPaint() защищенный Метод

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
Результат void
        protected override void OnPaint( PaintEventArgs e )
        {
            base.OnPaint( e );

            e.Graphics.FillRectangle( Brushes.Black, 0, 0, Width, Height );
            if ( m_SourceImage != null )
                e.Graphics.DrawImage( m_SourceImage, ImageClientRectangle, new RectangleF( 0, 0, m_SourceImage.Width, m_SourceImage.Height ), GraphicsUnit.Pixel );

            // Show custom swatches' location
            RectangleF		R = ImageClientRectangle;
            for ( int SwatchIndex=0; SwatchIndex < m_CustomSwatches.Length; SwatchIndex++ )
                if ( m_CustomSwatches[SwatchIndex] != null )
                {
                    WMath.Vector4D	Location = m_CustomSwatches[SwatchIndex];

                    PointF	TopLeft = new PointF( R.Left + Location.x * R.Width, R.Top + Location.y * R.Height );
                    PointF	BottomRight = new PointF( R.Left + Location.z * R.Width, R.Top + Location.w * R.Height );

                    e.Graphics.DrawRectangle( Pens.Red, TopLeft.X, TopLeft.Y, 1+BottomRight.X-TopLeft.X, 1+BottomRight.Y-TopLeft.Y );
                    e.Graphics.DrawString( SwatchIndex.ToString(), Font, Brushes.Red, 0.5f * (TopLeft.X + BottomRight.X - Font.Height), 0.5f * (TopLeft.Y + BottomRight.Y - Font.Height) );
                }
        }