Aracılığıyla paylaş


Graphics.ScaleTransform Yöntem

Tanım

Belirtilen ölçeklendirme işlemini nesnenin dönüştürme matrisine önceden uygulayarak bu Graphics dönüştürme matrisine uygular.

Aşırı Yüklemeler

ScaleTransform(Single, Single)

Belirtilen ölçeklendirme işlemini nesnenin dönüştürme matrisine önceden uygulayarak bu Graphics dönüştürme matrisine uygular.

ScaleTransform(Single, Single, MatrixOrder)

Belirtilen ölçeklendirme işlemini bu Graphics dönüştürme matrisine belirtilen sırada uygular.

ScaleTransform(Single, Single)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Belirtilen ölçeklendirme işlemini nesnenin dönüştürme matrisine önceden uygulayarak bu Graphics dönüştürme matrisine uygular.

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)

Parametreler

sx
Single

X yönünde ölçek faktörü.

sy
Single

Y yönünde ölçek faktörü.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve Paint olay işleyicisinin bir parametresi olan PaintEventArgsegerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Windows Formunun dünya dönüşüm matrisini 30 derece döndürür.

  • Ölçeklendirme dönüşümünü önleyerek bu matrisi x yönünde 3, y yönünde 1 kat ölçeklendirir.

  • Mavi kalemle ölçeklendirilmiş, döndürülmüş bir dikdörtgen çizer.

Sonuç hala bir dikdörtgendir.

public:
   void ScaleTransformFloat( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to rotate.
      e->Graphics->RotateTransform( 30.0F );

      // Then to scale, prepending to world transform.
      e->Graphics->ScaleTransform( 3.0F, 1.0F );

      // Draw scaled, rotated rectangle to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,3.0f ), 50, 0, 100, 40 );
   }
private void ScaleTransformFloat(PaintEventArgs e)
{

    // Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F);

    // Then to scale, prepending to world transform.
    e.Graphics.ScaleTransform(3.0F, 1.0F);

    // Draw scaled, rotated rectangle to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
}
Private Sub ScaleTransformFloat(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F)

    ' Then to scale, prepending to world transform.
    e.Graphics.ScaleTransform(3.0F, 1.0F)

    ' Draw scaled, rotated rectangle to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Blue, 3), 50, 0, 100, 40)
End Sub

Açıklamalar

Ölçeklendirme işlemi, dönüştürme matrisinin öğeleri (sx, sy, 1) olan bir çapraz matrisle çarpılmasından oluşur. Bu yöntem, ölçeklendirme matrisi tarafından Graphics dönüştürme matrisinin başına ekler.

Şunlara uygulanır

ScaleTransform(Single, Single, MatrixOrder)

Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs
Kaynak:
Graphics.cs

Belirtilen ölçeklendirme işlemini bu Graphics dönüştürme matrisine belirtilen sırada uygular.

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)

Parametreler

sx
Single

X yönünde ölçek faktörü.

sy
Single

Y yönünde ölçek faktörü.

order
MatrixOrder

Ölçeklendirme işleminin dönüştürme matrisine eklenip eklenmeyeceğini belirten MatrixOrder numaralandırmasının üyesi.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve Paint olay işleyicisinin bir parametresi olan PaintEventArgsegerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Windows Formunun dünya dönüşüm matrisini 30 derece döndürür.

  • Ölçeklendirme dönüşümünü Append üyesiyle ekleyerek bu matrisi x yönünde 3, y yönünde 1 kat ölçeklendirir.

  • Mavi kalemle döndürülmüş, ölçeklendirilmiş bir dikdörtgen çizer.

Sonuç bir paralelogramdır.

public:
   void ScaleTransformFloatMatrixOrder( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to rotate.
      e->Graphics->RotateTransform( 30.0F );

      // Then to scale, appending to world transform.
      e->Graphics->ScaleTransform( 3.0F, 1.0F, MatrixOrder::Append );

      // Draw rotated, scaled rectangle to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,3.0f ), 50, 0, 100, 40 );
   }
private void ScaleTransformFloatMatrixOrder(PaintEventArgs e)
{

    // Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F);

    // Then to scale, appending to world transform.
    e.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append);

    // Draw rotated, scaled rectangle to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
}
Private Sub ScaleTransformFloatMatrixOrder(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F)

    ' Then to scale, appending to world transform.
    e.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append)

    ' Draw rotated, scaled rectangle to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Blue, 3), 50, 0, 100, 40)
End Sub

Açıklamalar

Ölçeklendirme işlemi, dönüştürme matrisinin öğeleri (sx, sy, 1) olan bir çapraz matrisle çarpılmasından oluşur. Bu yöntem, Graphics dönüştürme matrisini order parametresine göre ölçeklendirme matrisine ekler veya ekler.

Şunlara uygulanır