共用方式為


LinearGradientBrush.RotateTransform 方法

定義

依指定的量旋轉局部幾何轉換。 這個方法會在轉換之前加上旋轉。

多載

RotateTransform(Single)

依指定的量旋轉局部幾何轉換。 這個方法會在轉換之前加上旋轉。

RotateTransform(Single, MatrixOrder)

依指定的順序,依指定的數量旋轉局部幾何轉換。

RotateTransform(Single)

來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs

依指定的量旋轉局部幾何轉換。 這個方法會在轉換之前加上旋轉。

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

參數

angle
Single

旋轉角度。

範例

如需範例,請參閱 RotateTransform

適用於

RotateTransform(Single, MatrixOrder)

來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs

依指定的順序,依指定的數量旋轉局部幾何轉換。

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)

參數

angle
Single

旋轉角度。

order
MatrixOrder

MatrixOrder,指定要附加或加上旋轉矩陣之前。

範例

下列程式代碼範例的設計目的是要與 Windows Forms 搭配使用,而且需要 PaintEventArgseOnPaint 事件物件。 程序代碼

請注意,下橢圓形的漸層在頂端橢圓形的 X 軸為 45 度的角度。 另請注意,使用對 TranslateTransform 方法的呼叫,將漸層填滿左邊緣與下橢圓形的左邊緣對齊。

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

適用於