Pen.ScaleTransform Metodo

Definizione

Scala la trasformazione geometrica locale in base ai fattori specificati. Il metodo antepone la matrice di scala alla trasformazione.

Overload

ScaleTransform(Single, Single)

Scala la trasformazione geometrica locale in base ai fattori specificati. Il metodo antepone la matrice di scala alla trasformazione.

ScaleTransform(Single, Single, MatrixOrder)

Scala la trasformazione geometrica locale in base ai fattori specificati nell'ordine indicato.

ScaleTransform(Single, Single)

Origine:
Pen.cs
Origine:
Pen.cs
Origine:
Pen.cs

Scala la trasformazione geometrica locale in base ai fattori specificati. Il metodo antepone la matrice di scala 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

Fattore in base al quale scalare la trasformazione nella direzione dell'asse X.

sy
Single

Fattore in base al quale scalare la trasformazione nella direzione dell'asse Y.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

Crea un oggetto Pen.

Disegna un rettangolo utilizzando la penna.

Scala la penna di 2 volte nella direzione dell'asse x.

Disegna un secondo rettangolo per illustrare la differenza.

public:
   void ScaleTransform_Example1( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ scalePen = gcnew Pen( Color::Black,5.0f );
      
      // Draw a rectangle with scalePen.
      e->Graphics->DrawRectangle( scalePen, 10, 10, 100, 100 );
      
      // Scale scalePen by 2X in the x-direction.
      scalePen->ScaleTransform( 2, 1 );
      
      // Draw a second rectangle with rotatePen.
      e->Graphics->DrawRectangle( scalePen, 120, 10, 100, 100 );
   }
public void ScaleTransform_Example1(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen scalePen = new Pen(Color.Black, 5);
             
    // Draw a rectangle with scalePen.
    e.Graphics.DrawRectangle(scalePen, 10, 10, 100, 100);
             
    // Scale scalePen by 2X in the x-direction.
    scalePen.ScaleTransform(2, 1);
             
    // Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(scalePen, 120, 10, 100, 100);
}
Public Sub ScaleTransform_Example1(ByVal e As PaintEventArgs)

    ' Create a Pen object.
    Dim scalePen As New Pen(Color.Black, 5)

    ' Draw a rectangle with scalePen.
    e.Graphics.DrawRectangle(scalePen, 10, 10, 100, 100)

    ' Scale scalePen by 2X in the x-direction.
    scalePen.ScaleTransform(2, 1)

    ' Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(scalePen, 120, 10, 100, 100)
End Sub

Si applica a

ScaleTransform(Single, Single, MatrixOrder)

Origine:
Pen.cs
Origine:
Pen.cs
Origine:
Pen.cs

Scala la trasformazione geometrica locale in base ai fattori specificati nell'ordine indicato.

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

Fattore in base al quale scalare la trasformazione nella direzione dell'asse X.

sy
Single

Fattore in base al quale scalare la trasformazione nella direzione dell'asse Y.

order
MatrixOrder

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

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea un oggetto Pen.

  • Disegna un rettangolo utilizzando la penna.

  • Scala la penna di 2 volte nella direzione dell'asse x.

  • Disegna un secondo rettangolo per illustrare la differenza.

public:
   void ScaleTransform_Example2( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ scalePen = gcnew Pen( Color::Black,5.0f );
      
      // Draw a rectangle with scalePen.
      e->Graphics->DrawRectangle( scalePen, 10, 10, 100, 100 );
      
      // Scale scalePen by 2X in the x-direction.
      scalePen->ScaleTransform( 2, 1, MatrixOrder::Prepend );
      
      // Draw a second rectangle with rotatePen.
      e->Graphics->DrawRectangle( scalePen, 120, 10, 100, 100 );
   }
public void ScaleTransform_Example2(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen scalePen = new Pen(Color.Black, 5);
             
    // Draw a rectangle with scalePen.
    e.Graphics.DrawRectangle(scalePen, 10, 10, 100, 100);
             
    // Scale scalePen by 2X in the x-direction.
    scalePen.ScaleTransform(2, 1, MatrixOrder.Prepend);
             
    // Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(scalePen, 120, 10, 100, 100);
}
Public Sub ScaleTransform_Example2(ByVal e As PaintEventArgs)

    ' Create a Pen object.
    Dim scalePen As New Pen(Color.Black, 5)

    ' Draw a rectangle with scalePen.
    e.Graphics.DrawRectangle(scalePen, 10, 10, 100, 100)

    ' Scale scalePen by 2X in the x-direction.
    scalePen.ScaleTransform(2, 1, MatrixOrder.Prepend)

    ' Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(scalePen, 120, 10, 100, 100)
End Sub

Si applica a