LinearGradientBrush.RotateTransform Metoda

Definicja

Obraca lokalną transformację geometryczną o określoną kwotę. Ta metoda poprzedza rotację przekształcenia.

Przeciążenia

RotateTransform(Single)

Obraca lokalną transformację geometryczną o określoną kwotę. Ta metoda poprzedza rotację przekształcenia.

RotateTransform(Single, MatrixOrder)

Obraca lokalną transformację geometryczną o określoną kwotę w określonej kolejności.

RotateTransform(Single)

Obraca lokalną transformację geometryczną o określoną kwotę. Ta metoda poprzedza rotację przekształcenia.

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

Parametry

angle
Single

Kąt obrotu.

Przykłady

Aby zapoznać się z przykładem, zobacz RotateTransform.

Dotyczy

RotateTransform(Single, MatrixOrder)

Obraca lokalną transformację geometryczną o określoną kwotę w określonej kolejności.

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

Kąt obrotu.

order
MatrixOrder

Element MatrixOrder określający, czy ma zostać dołączona lub wstępnie utworzona macierz rotacji.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgs eOnPaint obiektu zdarzenia . Kod

  • Tworzy nowy adres LinearGradientBrush.

  • Rysuje wielokropek na ekranie przy użyciu tego pędzla.

  • LinearGradientBrush Obraca 45 stopni, wywołując metodę RotateTransform .

  • Rysuje wielokropek na ekran bezpośrednio pod pierwszym wielokropkiem, używając obróconego pędzla.

Zwróć uwagę, że gradient dolnej wielokropka znajduje się pod kątem 45 stopni do osi x górnej wielokropka. Zwróć również uwagę, że wywołanie TranslateTransform metody jest używane do uzasadnienia lewej krawędzi wypełnienia gradientu z lewą krawędzią dolnej wielokropka.

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

Dotyczy