Condividi tramite


LinearGradientBrush.RotateTransform Metodo

Definizione

Ruota la trasformazione geometrica locale in base al valore specificato. Questo metodo antepone la rotazione alla trasformazione.

Overload

RotateTransform(Single)

Ruota la trasformazione geometrica locale in base al valore specificato. Questo metodo antepone la rotazione alla trasformazione.

RotateTransform(Single, MatrixOrder)

Ruota la trasformazione geometrica locale in base al valore specificato nell'ordine indicato.

RotateTransform(Single)

Origine:
LinearGradientBrush.cs
Origine:
LinearGradientBrush.cs
Origine:
LinearGradientBrush.cs

Ruota la trasformazione geometrica locale in base al valore specificato. Questo metodo antepone la rotazione alla trasformazione.

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

Parametri

angle
Single

Angolo di rotazione.

Esempio

Per un esempio, vedere RotateTransform.

Si applica a

RotateTransform(Single, MatrixOrder)

Origine:
LinearGradientBrush.cs
Origine:
LinearGradientBrush.cs
Origine:
LinearGradientBrush.cs

Ruota la trasformazione geometrica locale in base al valore specificato nell'ordine indicato.

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)

Parametri

angle
Single

Angolo di rotazione.

order
MatrixOrder

Oggetto MatrixOrder che specifica se accodare o anteporre la matrice di rotazione.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, un OnPaint oggetto evento. Codice

  • Crea un nuovo oggetto LinearGradientBrush.

  • Disegna un puntini di sospensione sullo schermo usando questo pennello.

  • Ruota i LinearGradientBrush 45 gradi chiamando il RotateTransform metodo .

  • Disegna un puntini di sospensione sullo schermo direttamente sotto i primi puntini di sospensione, usando il pennello ruotato.

Si noti che la sfumatura dei puntini di sospensione inferiore è a un angolo di 45 gradi all'asse x dei puntini di sospensione superiore. Si noti anche che una chiamata al TranslateTransform metodo viene usata per giustificare il bordo sinistro del riempimento sfumatura con il bordo sinistro dell'ellisse inferiore.

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

Si applica a