Språk

PathGradientBrush.RotateTransform Metod

Definition

Tillämpar en medsols rotation av den angivna vinkeln på den lokala geometriska transformeringen.

Överlagringar

Name Description
RotateTransform(Single)

Roterar den lokala geometriska transformen med den angivna mängden. Den här metoden förbereder rotationen till transformeringen.

RotateTransform(Single, MatrixOrder)

Roterar den lokala geometriska transformen med den angivna mängden i den angivna ordningen.

RotateTransform(Single)

Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs

Roterar den lokala geometriska transformen med den angivna mängden. Den här metoden förbereder rotationen till transformeringen.

public:
 void RotateTransform(float angle);
public void RotateTransform(float angle);
member this.RotateTransform : single -> unit
Public Sub RotateTransform (angle As Single)

Parametrar

angle
Single

Rotationsvinkeln (omfattningen).

Exempel

Ett exempel finns i RotateTransform.

Gäller för

RotateTransform(Single, MatrixOrder)

Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs

Roterar den lokala geometriska transformen med den angivna mängden i den angivna ordningen.

public:
 void RotateTransform(float angle, System::Drawing::Drawing2D::MatrixOrder order);
public void RotateTransform(float angle, System.Drawing.Drawing2D.MatrixOrder order);
member this.RotateTransform : single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub RotateTransform (angle As Single, order As MatrixOrder)

Parametrar

angle
Single

Rotationsvinkeln (omfattningen).

order
MatrixOrder

En MatrixOrder som anger om rotationsmatrisen ska läggas till eller förberedas.

Exempel

Följande kodexempel är utformat för användning med Windows Forms och kräver PaintEventArgse, ett OnPaint händelseobjekt. Koden utför följande åtgärder:

  • Skapar en grafiksökväg och lägger till en rektangel i den.

  • Skapar en PathGradientBrush från sökvägspunkterna (i det här exemplet bildar punkterna en rektangel, men det kan vara de flesta former).

  • Ställer in mittenfärgen till röd och den omgivande färgen till blå.

  • PathGradientBrush Ritar till skärmen innan du tillämpar rotationstransformen.

  • Tillämpar rotationstransformen på penseln med hjälp av dess RotateTransform metod.

  • Ritar den roterade penseln (rektangel) till skärmen.

Observera att den nedre rektangeln roteras 45 grader jämfört med den som ritades före översättningen.

public:
   void RotateTransformExample( PaintEventArgs^ e )
   {
      // Create a graphics path and add an ellipse.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle rect = Rectangle(100,20,100,50);
      myPath->AddRectangle( rect );

      // Get the path's array of points.
      array<PointF>^myPathPointArray = myPath->PathPoints;

      // Create a path gradient brush.
      PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );

      // Set the color span.
      myPGBrush->CenterColor = Color::Red;
      array<Color>^ mySurroundColor = {Color::Blue};
      myPGBrush->SurroundColors = mySurroundColor;

      // Draw the brush to the screen prior to transformation.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Apply the rotate transform to the brush.
      myPGBrush->RotateTransform( 45, MatrixOrder::Append );

      // Draw the brush to the screen again after applying the
      // transform.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
   }
public void RotateTransformExample(PaintEventArgs e)
{
             
    // Create a graphics path and add an ellipse.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle rect = new Rectangle(100, 20, 100, 50);
    myPath.AddRectangle(rect);
             
    // Get the path's array of points.
    PointF[] myPathPointArray = myPath.PathPoints;
             
    // Create a path gradient brush.
    PathGradientBrush myPGBrush = new
        PathGradientBrush(myPathPointArray);
             
    // Set the color span.
    myPGBrush.CenterColor = Color.Red;
    Color[] mySurroundColor = {Color.Blue};
    myPGBrush.SurroundColors = mySurroundColor;
             
    // Draw the brush to the screen prior to transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Apply the rotate transform to the brush.
    myPGBrush.RotateTransform(45, MatrixOrder.Append);
             
    // Draw the brush to the screen again after applying the
    // transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
Public Sub RotateTransformExample(ByVal e As PaintEventArgs)

    ' Create a graphics path and add a rectangle.
    Dim myPath As New GraphicsPath
    Dim rect As New Rectangle(100, 20, 100, 50)
    myPath.AddRectangle(rect)

    ' Get the path's array of points.
    Dim myPathPointArray As PointF() = myPath.PathPoints

    ' Create a path gradient brush.
    Dim myPGBrush As New PathGradientBrush(myPathPointArray)

    ' Set the color span.
    myPGBrush.CenterColor = Color.Red
    Dim mySurroundColor As Color() = {Color.Blue}
    myPGBrush.SurroundColors = mySurroundColor

    ' Draw the brush to the screen prior to transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

    ' Apply the rotate transform to the brush.
    myPGBrush.RotateTransform(45, MatrixOrder.Append)

    ' Draw the brush to the screen again after applying the
    ' transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub

Gäller för