Matrix.Scale Metoda

Definicja

Stosuje określony wektor skalowania do tego Matrix , tworząc wektor skalowania.

Przeciążenia

Scale(Single, Single)

Stosuje określony wektor skalowania do tego Matrix , tworząc wektor skalowania.

Scale(Single, Single, MatrixOrder)

Stosuje określony wektor skalowania (scaleX i scaleY) do tego Matrix przy użyciu określonej kolejności.

Scale(Single, Single)

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

Stosuje określony wektor skalowania do tego Matrix , tworząc wektor skalowania.

public:
 void Scale(float scaleX, float scaleY);
public void Scale (float scaleX, float scaleY);
member this.Scale : single * single -> unit
Public Sub Scale (scaleX As Single, scaleY As Single)

Parametry

scaleX
Single

Wartość, za pomocą której ma być Matrix skalowana w kierunku osi x.

scaleY
Single

Wartość, według której ma być Matrix skalowana w kierunku osi y.

Przykłady

Aby zapoznać się z przykładem, zobacz Scale(Single, Single, MatrixOrder).

Dotyczy

Scale(Single, Single, MatrixOrder)

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

Stosuje określony wektor skalowania (scaleX i scaleY) do tego Matrix przy użyciu określonej kolejności.

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

Parametry

scaleX
Single

Wartość, za pomocą której ma być Matrix skalowana w kierunku osi x.

scaleY
Single

Wartość, według której ma być Matrix skalowana w kierunku osi y.

order
MatrixOrder

Element MatrixOrder określający kolejność (dołącz lub prepend), w której jest stosowany wektor skalowania do tego Matrix.

Przykłady

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

  • Rysuje prostokąt na ekranie przed zastosowaniem przekształcenia skalowania (niebieski prostokąt).

  • Tworzy macierz i skaluje ją o 3 na osi x i 2 na osi y.

  • Stosuje tę transformację macierzy do prostokąta.

  • Rysuje przekształcony prostokąt na ekran (czerwony prostokąt).

Zwróć uwagę, że czerwony prostokąt został przeskalowany przez współczynnik 3 na osi x i o 2 na osi y, w tym lewy górny róg prostokąta (punkt początkowy prostokąta).

public:
   void ScaleExample( PaintEventArgs^ e )
   {
      Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
      Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );

      // Draw the rectangle to the screen before applying the
      // transform.
      e->Graphics->DrawRectangle( myPen, 50, 50, 100, 100 );

      // Create a matrix and scale it.
      Matrix^ myMatrix = gcnew Matrix;
      myMatrix->Scale( 3, 2, MatrixOrder::Append );

      // Draw the rectangle to the screen again after applying the
      // transform.
      e->Graphics->Transform = myMatrix;
      e->Graphics->DrawRectangle( myPen2, 50, 50, 100, 100 );
   }
public void ScaleExample(PaintEventArgs e)
{
    Pen myPen = new Pen(Color.Blue, 1);
    Pen myPen2 = new Pen(Color.Red, 1);
             
    // Draw the rectangle to the screen before applying the
    // transform.
    e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100);
             
    // Create a matrix and scale it.
    Matrix myMatrix = new Matrix();
    myMatrix.Scale(3, 2, MatrixOrder.Append);
             
    // Draw the rectangle to the screen again after applying the
    // transform.
    e.Graphics.Transform = myMatrix;
    e.Graphics.DrawRectangle(myPen2, 50, 50, 100, 100);
}
Public Sub ScaleExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)

    ' Draw the rectangle to the screen before applying the
    ' transform.
    e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100)

    ' Create a matrix and scale it.
    Dim myMatrix As New Matrix
    myMatrix.Scale(3, 2, MatrixOrder.Append)

    ' Draw the rectangle to the screen again after applying the
    ' transform.
    e.Graphics.Transform = myMatrix
    e.Graphics.DrawRectangle(myPen2, 50, 50, 100, 100)
End Sub

Dotyczy