PathGradientBrush.RotateTransform Methode

Definitie

Hiermee past u een klokgewijze draaiing van de opgegeven hoek toe op de lokale geometrische transformatie.

Overloads

Name Description
RotateTransform(Single)

Hiermee roteert u de lokale geometrische transformatie met de opgegeven hoeveelheid. Met deze methode wordt de rotatie voorafgegaan door de transformatie.

RotateTransform(Single, MatrixOrder)

Hiermee draait u de lokale geometrische transformatie met de opgegeven hoeveelheid in de opgegeven volgorde.

RotateTransform(Single)

Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs

Hiermee roteert u de lokale geometrische transformatie met de opgegeven hoeveelheid. Met deze methode wordt de rotatie voorafgegaan door de transformatie.

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

Parameters

angle
Single

De hoek (omvang) van de draaiing.

Voorbeelden

Zie RotateTransformvoor een voorbeeld.

Van toepassing op

RotateTransform(Single, MatrixOrder)

Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs
Bron:
PathGradientBrush.cs

Hiermee draait u de lokale geometrische transformatie met de opgegeven hoeveelheid in de opgegeven volgorde.

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)

Parameters

angle
Single

De hoek (omvang) van de draaiing.

order
MatrixOrder

Een MatrixOrder die aangeeft of de rotatiematrix moet worden toegevoegd of voorbereid.

Voorbeelden

Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een OnPaint-gebeurtenisobject. De code voert de volgende acties uit:

  • Hiermee maakt u een grafisch pad en voegt u er een rechthoek aan toe.

  • Hiermee maakt u een PathGradientBrush van de padpunten (in dit voorbeeld vormen de punten een rechthoek, maar dit kan de meeste vormen zijn).

  • Hiermee stelt u de middelste kleur in op rood en de omringende kleur op blauw.

  • Hiermee tekent u het PathGradientBrush scherm voordat u de draaitransformatie toepast.

  • Hiermee past u de draaitransformatie toe op het kwast met behulp van RotateTransform de methode.

  • Hiermee tekent u de gedraaide kwast (rechthoek) naar het scherm.

U ziet dat de onderste rechthoek 45 graden wordt gedraaid in vergelijking met de rechthoek die vóór de vertaling is getekend.

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

Van toepassing op