Pen.ScaleTransform Metoda

Definice

Škáluje místní geometrické transformace podle zadaných faktorů. Tato metoda předpenuje matici škálování na transformaci.

Přetížení

ScaleTransform(Single, Single)

Škáluje místní geometrické transformace podle zadaných faktorů. Tato metoda předpenuje matici škálování na transformaci.

ScaleTransform(Single, Single, MatrixOrder)

Škáluje místní geometrické transformace podle zadaných faktorů v zadaném pořadí.

ScaleTransform(Single, Single)

Zdroj:
Pen.cs
Zdroj:
Pen.cs
Zdroj:
Pen.cs

Škáluje místní geometrické transformace podle zadaných faktorů. Tato metoda předpenuje matici škálování na transformaci.

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

Faktor, podle kterého se má škálovat transformace ve směru osy x.

sy
Single

Faktor, podle kterého se má škálovat transformace ve směru osy y.

Příklady

Následující příklad kódu je určen pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

Vytvoří .Pen

Nakreslí obdélník pomocí pera.

Nastaví měřítko pera 2krát ve směru osy x.

Nakreslí druhý obdélník, který demonstruje rozdíl.

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

Platí pro

ScaleTransform(Single, Single, MatrixOrder)

Zdroj:
Pen.cs
Zdroj:
Pen.cs
Zdroj:
Pen.cs

Škáluje místní geometrické transformace podle zadaných faktorů v zadaném pořadí.

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

Faktor, podle kterého se má škálovat transformace ve směru osy x.

sy
Single

Faktor, podle kterého se má škálovat transformace ve směru osy y.

order
MatrixOrder

A MatrixOrder , který určuje, zda má být matice škálování připojena nebo předem.

Příklady

Následující příklad kódu je určen pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří .Pen

  • Nakreslí obdélník pomocí pera.

  • Nastaví měřítko pera 2krát ve směru osy x.

  • Nakreslí druhý obdélník, který demonstruje rozdíl.

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

Platí pro