Partager via


LinearGradientBrush.RotateTransform Méthode

Définition

Fait pivoter la transformation géométrique locale par la quantité spécifiée. Cette méthode précède la rotation de la transformation.

Surcharges

RotateTransform(Single)

Fait pivoter la transformation géométrique locale par la quantité spécifiée. Cette méthode précède la rotation de la transformation.

RotateTransform(Single, MatrixOrder)

Fait pivoter la transformation géométrique locale par la quantité spécifiée dans l’ordre spécifié.

RotateTransform(Single)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Fait pivoter la transformation géométrique locale par la quantité spécifiée. Cette méthode précède la rotation de la transformation.

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

Paramètres

angle
Single

Angle de rotation.

Exemples

Pour obtenir un exemple, consultez RotateTransform.

S’applique à

RotateTransform(Single, MatrixOrder)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Fait pivoter la transformation géométrique locale par la quantité spécifiée dans l’ordre spécifié.

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)

Paramètres

angle
Single

Angle de rotation.

order
MatrixOrder

Un MatrixOrder qui spécifie s’il faut ajouter ou prépender la matrice de rotation.

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, un objet d’événement OnPaint. Code

  • Crée une LinearGradientBrush.

  • Dessine un ellipse à l’écran à l’aide de ce pinceau.

  • Fait pivoter les LinearGradientBrush 45 degrés en appelant la méthode RotateTransform.

  • Dessine un ellipse à l’écran directement sous le premier ellipse, à l’aide du pinceau pivoté.

Notez que le dégradé de l’ellipse inférieure est à un angle de 45 degrés à l’axe x de l’ellipse supérieure. Notez également qu’un appel à la méthode TranslateTransform est utilisé pour justifier le bord gauche du remplissage dégradé avec le bord gauche de l’ellipse inférieure.

private:
   void RotateTransformExample( PaintEventArgs^ e )
   {
      // Create a LinearGradientBrush.
      Rectangle myRect = Rectangle(20,20,200,100);
      LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true );

      // Draw an ellipse to the screen using the LinearGradientBrush.
      e->Graphics->FillEllipse( myLGBrush, myRect );

      // Rotate the LinearGradientBrush.
      myLGBrush->RotateTransform( 45.0f, MatrixOrder::Prepend );

      // Rejustify the brush to start at the left edge of the ellipse.
      myLGBrush->TranslateTransform(  -100.0f, 0.0f );

      // Draw a second ellipse to the screen using
      // the transformed brush.
      e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 );
   }
 private void RotateTransformExample(PaintEventArgs e)
 {
              
     // Create a LinearGradientBrush.
     Rectangle myRect = new Rectangle(20, 20, 200, 100);
     LinearGradientBrush myLGBrush = new LinearGradientBrush(
         myRect, Color.Blue, Color.Red,  0.0f, true);
              
     // Draw an ellipse to the screen using the LinearGradientBrush.
     e.Graphics.FillEllipse(myLGBrush, myRect);
              
     // Rotate the LinearGradientBrush.
     myLGBrush.RotateTransform(45.0f, MatrixOrder.Prepend);

     // Rejustify the brush to start at the left edge of the ellipse.
     myLGBrush.TranslateTransform(-100.0f, 0.0f);
              
     // Draw a second ellipse to the screen using
     // the transformed brush.
     e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100);
 }
Public Sub RotateTransformExample(ByVal e As PaintEventArgs)

    ' Create a LinearGradientBrush.
    Dim myRect As New Rectangle(20, 20, 200, 100)
    Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
    Color.Red, 0.0F, True)

    ' Draw an ellipse to the screen using the LinearGradientBrush.
    e.Graphics.FillEllipse(myLGBrush, myRect)

    ' Rotate the LinearGradientBrush.
    myLGBrush.RotateTransform(45.0F, MatrixOrder.Prepend)

    ' Rejustify the brush to start at the left edge of the ellipse.
    myLGBrush.TranslateTransform(-100.0F, 0.0F)

    ' Draw a second ellipse to the screen using the transformed brush.
    e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100)
End Sub

S’applique à