Matrix.Scale 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
透過在縮尺向量前加上指定的比例向量來應用於此 Matrix 。
多載
| 名稱 | Description |
|---|---|
| Scale(Single, Single) |
透過在縮尺向量前加上指定的比例向量來應用於此 Matrix 。 |
| Scale(Single, Single, MatrixOrder) |
並依指定順序將指定的尺度向量( |
Scale(Single, Single)
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
透過在縮尺向量前加上指定的比例向量來應用於此 Matrix 。
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)
參數
範例
如需範例,請參閱 Scale(Single, Single, MatrixOrder)。
適用於
Scale(Single, Single, MatrixOrder)
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
- 來源:
- Matrix.cs
並依指定順序將指定的尺度向量(scaleX 和 scaleY)套用於此 Matrix 。
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)
參數
- order
- MatrixOrder
A MatrixOrder 指定了將尺度向量應用於此 Matrix的順序(附加或前置)。
範例
以下程式碼範例是為 Windows Forms 設計,並需要 PaintEventArgse,一個 Paint 事件物件。 此程式碼會執行下列動作:
在套用縮放轉換(藍色矩形)前,先在螢幕上畫一個矩形。
建立一個矩陣,並在 x 軸上縮放 3,y 軸上縮放 2。
將此矩陣轉換應用於矩形。
將轉換後的矩形(紅色矩形)繪製到螢幕上。
注意紅色矩形在 x 軸被縮放了 3 倍,y 軸縮放了 2 倍,包括矩形的左上角(矩形的起點)。
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