PathGradientBrush.RotateTransform Metoda

Definice

Použije otočení po směru hodinových ručiček zadaného úhlu u místní geometrické transformace.

Přetížení

Name Description
RotateTransform(Single)

Otočí místní geometrické transformace o zadanou hodnotu. Tato metoda předpenpenduje otočení na transformaci.

RotateTransform(Single, MatrixOrder)

Otočí místní geometrické transformace o zadanou hodnotu v zadaném pořadí.

RotateTransform(Single)

Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs

Otočí místní geometrické transformace o zadanou hodnotu. Tato metoda předpenpenduje otočení na transformaci.

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

Parametry

angle
Single

Úhel (rozsah) otáčení.

Příklady

Pro příklad viz RotateTransform.

Platí pro

RotateTransform(Single, MatrixOrder)

Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs
Zdroj:
PathGradientBrush.cs

Otočí místní geometrické transformace o zadanou hodnotu v zadaném pořadí.

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)

Parametry

angle
Single

Úhel (rozsah) otáčení.

order
MatrixOrder

Hodnota určující MatrixOrder , zda se má připojit nebo předvést matici otočení.

Příklady

Následující příklad kódu je určený pro použití s model Windows Forms a vyžaduje PaintEventArgse, objekt události OnPaint. Kód provede následující akce:

  • Vytvoří grafickou cestu a přidá do ní obdélník.

  • PathGradientBrush Vytvoří z bodů cesty (v tomto příkladu body tvoří obdélník, ale může to být většina obrazců).

  • Nastaví středovou barvu na červenou a okolní barvu na modrou.

  • Nakreslí PathGradientBrush na obrazovku před použitím transformace otočení.

  • Použije transformaci otočení na štětec pomocí jeho RotateTransform metody.

  • Nakreslí otočený štětec (obdélník) na obrazovku.

Všimněte si, že dolní obdélník je otočený o 45 stupňů oproti tomu, který byl nakreslen před překladem.

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

Platí pro