LinearGradientBrush.ScaleTransform Metoda

Definicja

Skaluje lokalną transformację geometryczną według określonych kwot. Ta metoda poprzedza macierz skalowania do przekształcenia.

Przeciążenia

ScaleTransform(Single, Single)

Skaluje lokalną transformację geometryczną według określonych kwot. Ta metoda poprzedza macierz skalowania do przekształcenia.

ScaleTransform(Single, Single, MatrixOrder)

Skaluje lokalną transformację geometryczną według określonych kwot w określonej kolejności.

ScaleTransform(Single, Single)

Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs

Skaluje lokalną transformację geometryczną według określonych kwot. Ta metoda poprzedza macierz skalowania do przekształcenia.

public:
 void ScaleTransform(float sx, float sy);
public void ScaleTransform (float sx, float sy);
member this.ScaleTransform : single * single -> unit
Public Sub ScaleTransform (sx As Single, sy As Single)

Parametry

sx
Single

Ilość, o jaką należy skalować transformację w kierunku osi x.

sy
Single

Ilość, o jaką należy skalować transformację w kierunku osi y.

Przykłady

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

Dotyczy

ScaleTransform(Single, Single, MatrixOrder)

Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs

Skaluje lokalną transformację geometryczną według określonych kwot w określonej kolejności.

public:
 void ScaleTransform(float sx, float sy, System::Drawing::Drawing2D::MatrixOrder order);
public void ScaleTransform (float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order);
member this.ScaleTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub ScaleTransform (sx As Single, sy As Single, order As MatrixOrder)

Parametry

sx
Single

Ilość, o jaką należy skalować transformację w kierunku osi x.

sy
Single

Ilość, o jaką należy skalować transformację w kierunku osi y.

order
MatrixOrder

Element MatrixOrder określający, czy należy dołączyć lub wstępnie uzupełnić macierz skalowania.

Przykłady

Poniższy przykład kodu jest przeznaczony do użytku z Windows Forms i wymaga PaintEventArgseobiektu OnPaint zdarzenia . Kod wykonuje następujące akcje:

  • Tworzy nowy adres LinearGradientBrush.

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

  • Skaluje wartość LinearGradientBrush według współczynnika dwóch na osi x.

  • Rysuje wielokropek na ekran bezpośrednio poniżej pierwszego wielokropka, używając skalowanego pędzla.

Zwróć uwagę, że gradient dolnej wielokropka jest rozciągany przez współczynnik dwóch. Zwróć również uwagę, że wywołanie TranslateTransform metody służy do uzasadnienia lewej krawędzi wypełnienia gradientu lewą krawędzią wielokropka.

private:
   void ScaleTransformExample( 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 );

      // Scale the LinearGradientBrush.
      myLGBrush->ScaleTransform( 2.0f, 1.0f, MatrixOrder::Prepend );

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

      // Draw a second ellipse to the screen using
      // the transformed brush.
      e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 );
   }
private void ScaleTransformExample(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);
             
    // Scale the LinearGradientBrush.
    myLGBrush.ScaleTransform(2.0f, 1.0f, MatrixOrder.Prepend);
   
    // Rejustify the brush to start at the left edge of the ellipse.
    myLGBrush.TranslateTransform(-20.0f, 0.0f);
             
    // Draw a second ellipse to the screen using
    // the transformed brush.
    e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100);
}
Public Sub ScaleTransformExample(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)

    ' Scale the LinearGradientBrush.
    myLGBrush.ScaleTransform(2.0F, 1.0F, MatrixOrder.Prepend)

    ' Rejustify the brush to start at the left edge of the ellipse.
    myLGBrush.TranslateTransform(-20.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