Alteridem.WinTouch.Demo.GestureControl.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaint( PaintEventArgs e )
        {
            // Draw Background
            e.Graphics.FillRectangle( _backBrushes[_backBrush], 0, 0, Width, Height );

            // Draw Info
            string info = string.Format( "Pos:{0} Size:{1} Rotation:{2}", _location, _size, _rotation );
            e.Graphics.DrawString( info, SystemFonts.DefaultFont, Brushes.Black, 5, 5 );

            // Draw Square
            e.Graphics.TranslateTransform( _location.X, _location.Y );
            e.Graphics.RotateTransform( (float)_rotation );
            e.Graphics.TranslateTransform( -_location.X, -_location.Y );
            e.Graphics.DrawImage( m_image, _location.X - _size / 2, _location.Y - _size / 2, _size, _size );
        }
    }