LinearGradientBrush.RotateTransform Méthode

Définition

Fait pivoter la transformation géométrique locale conformément à la valeur spécifiée. Cette méthode ajoute la rotation avant la transformation.

Surcharges

RotateTransform(Single)

Fait pivoter la transformation géométrique locale conformément à la valeur spécifiée. Cette méthode ajoute la rotation avant la transformation.

RotateTransform(Single, MatrixOrder)

Fait pivoter la transformation géométrique locale conformément à la valeur et à l'ordre spécifiés.

RotateTransform(Single)

Fait pivoter la transformation géométrique locale conformément à la valeur spécifiée. Cette méthode ajoute la rotation avant 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)

Fait pivoter la transformation géométrique locale conformément à la valeur et à l'ordre spécifiés.

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

MatrixOrder qui spécifie si la matrice de rotation doit être ajoutée avant ou après.

Exemples

L’exemple de code suivant est conçu pour une utilisation avec Windows Forms, et nécessite PaintEventArgs e, un objet d’événementOnPaint. Code

  • Crée un LinearGradientBrush.

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

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

  • Dessine un ellipse sur 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 TranslateTransform méthode 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 à