System.Drawing.Drawing2D.Matrix.RotateAt C# (CSharp) Method

RotateAt() public method

public RotateAt ( float angle, PointF point ) : void
angle float
point PointF
return void
        public void RotateAt(float angle, PointF point)
        {
            RotateAt (angle, point, MatrixOrder.Prepend);
        }

Same methods

Matrix::RotateAt ( float angle, PointF point, MatrixOrder order ) : void

Usage Example

Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics myGraphics = e.Graphics;
            Pen myPen = new Pen(Color.Black, 1.0f);
            GraphicsPath gp = new GraphicsPath();
            Matrix RotationTransform;

            float centerX = this.Size.Width / 2f;
            float centerY = this.Size.Height / 2f;

            gp.AddPolygon(new PointF[] {
                new PointF(centerX, centerY - 5),
                new PointF(centerX-5, centerY + 5),
                new PointF(centerX+5, centerY + 5)
            });

            RotationTransform = new Matrix(1, 0, 0, 1, 0, 0); // rotation matrix
            PointF RotationPoint = new PointF(centerX, centerY); // rotation point
            RotationTransform.RotateAt(heading, RotationPoint);
            gp.Transform(RotationTransform);

            myGraphics.FillPath(myPen.Brush, gp);
            myGraphics.DrawPath(myPen, gp);
            myPen.Dispose();
            gp.Dispose();
        }
All Usage Examples Of System.Drawing.Drawing2D.Matrix::RotateAt