RotateTransform With MatrixOrder.Prepend : RotateTransform « 2D Graphics « VB.Net Tutorial






RotateTransform With MatrixOrder.Prepend
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class RotateTransformWithMatrixOrderPrepend
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

public class Form1
  Inherits System.Windows.Forms.Form

  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
      e.Graphics.ScaleTransform(90, 90, MatrixOrder.Append)

      e.Graphics.TranslateTransform( _
          Me.ClientRectangle.Width \ 2, _
          Me.ClientRectangle.Height \ 2, _
          MatrixOrder.Append)

      For i As Integer = 5 To 90 Step 5
          e.Graphics.RotateTransform(5, MatrixOrder.Prepend)
          e.Graphics.DrawRectangle(New Pen(Color.Black, 0), -1, -1, 2, 2)
      Next i
  End Sub

  Public Sub New()
    MyBase.New()
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  End Sub
End Class








17.80.RotateTransform
17.80.1.Scale first, then Transform, then RotateScale first, then Transform, then Rotate
17.80.2.RotateTransform With MatrixOrder.PrependRotateTransform With MatrixOrder.Prepend
17.80.3.RotateTransform and draw EllipseRotateTransform and draw Ellipse