Condividi tramite


LinearGradientBrush.ScaleTransform Metodo

Definizione

Ridimensiona la trasformazione geometrica locale in base agli importi specificati. Questo metodo antepone la matrice di ridimensionamento alla trasformazione.

Overload

ScaleTransform(Single, Single)

Ridimensiona la trasformazione geometrica locale in base agli importi specificati. Questo metodo antepone la matrice di ridimensionamento alla trasformazione.

ScaleTransform(Single, Single, MatrixOrder)

Ridimensiona la trasformazione geometrica locale in base agli importi specificati nell'ordine specificato.

ScaleTransform(Single, Single)

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

Ridimensiona la trasformazione geometrica locale in base agli importi specificati. Questo metodo antepone la matrice di ridimensionamento alla trasformazione.

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)

Parametri

sx
Single

Quantità in base alla quale ridimensionare la trasformazione nella direzione dell'asse x.

sy
Single

Quantità in base alla quale ridimensionare la trasformazione nella direzione dell'asse y.

Esempio

Per un esempio, vedere ScaleTransform.

Si applica a

ScaleTransform(Single, Single, MatrixOrder)

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

Ridimensiona la trasformazione geometrica locale in base agli importi specificati nell'ordine specificato.

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)

Parametri

sx
Single

Quantità in base alla quale ridimensionare la trasformazione nella direzione dell'asse x.

sy
Single

Quantità in base alla quale ridimensionare la trasformazione nella direzione dell'asse y.

order
MatrixOrder

Oggetto MatrixOrder che specifica se aggiungere o anteporre la matrice di ridimensionamento.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse, un oggetto evento OnPaint. Il codice esegue le azioni seguenti:

  • Crea un nuovo LinearGradientBrush.

  • Disegnare un'ellisse sullo schermo usando questo pennello.

  • Ridimensiona il LinearGradientBrush di un fattore di due nell'asse x.

  • Disegna un'ellisse sullo schermo direttamente sotto il primo ellisse, usando il pennello scalato.

Si noti che la sfumatura dell'ellisse inferiore viene estesa da un fattore di due. Si noti anche che viene usata una chiamata al metodo TranslateTransform per giustificare il bordo sinistro del riempimento sfumato con il bordo sinistro dell'ellisse.

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

Si applica a