LinearGradientBrush.ScaleTransform 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
以指定的數量,縮放局部的幾何轉換。 這個方法預先規劃轉換的縮放矩陣。
多載
ScaleTransform(Single, Single) |
以指定的數量,縮放局部的幾何轉換。 這個方法預先規劃轉換的縮放矩陣。 |
ScaleTransform(Single, Single, MatrixOrder) |
依照指定的順序,根據指定的數量來縮放局部幾何轉換。 |
ScaleTransform(Single, Single)
以指定的數量,縮放局部的幾何轉換。 這個方法預先規劃轉換的縮放矩陣。
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)
參數
- sx
- Single
用來縮放 X 軸方向變換的數量。
- sy
- Single
用來縮放 Y 軸方向變換的數量。
範例
如需範例,請參閱 ScaleTransform。
適用於
ScaleTransform(Single, Single, MatrixOrder)
依照指定的順序,根據指定的數量來縮放局部幾何轉換。
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)
參數
- sx
- Single
用來縮放 X 軸方向變換的數量。
- sy
- Single
用來縮放 Y 軸方向變換的數量。
- order
- MatrixOrder
MatrixOrder,指定要在之後或之前附加縮放矩陣。
範例
下列程式代碼範例是設計來搭配 Windows Forms 使用,而且需要 PaintEventArgse
事件OnPaint物件。 此程式碼會執行下列動作:
建立新的 LinearGradientBrush。
使用此筆刷將省略號繪製到畫面。
以 LinearGradientBrush X 軸中的兩個因數來縮放 。
使用縮放筆刷,將省略號繪製到畫面正下方的第一個橢圓形。
請注意,下角橢圓形的漸層會以兩倍的因數延展。 另請注意,方法的 TranslateTransform 呼叫是用來讓漸層填滿左邊緣與橢圓形的左邊緣對齊。
private:
void ScaleTransformExample( PaintEventArgs^ e )
{
// Create a LinearGradientBrush.
Rectangle myRect = Rectangle(20,20,200,100);
LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true );
// Draw an ellipse to the screen using the LinearGradientBrush.
e->Graphics->FillEllipse( myLGBrush, myRect );
// Scale the LinearGradientBrush.
myLGBrush->ScaleTransform( 2.0f, 1.0f, MatrixOrder::Prepend );
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush->TranslateTransform( -20.0f, 0.0f );
// Draw a second ellipse to the screen using
// the transformed brush.
e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 );
}
private void ScaleTransformExample(PaintEventArgs e)
{
// Create a LinearGradientBrush.
Rectangle myRect = new Rectangle(20, 20, 200, 100);
LinearGradientBrush myLGBrush = new LinearGradientBrush(
myRect, Color.Blue, Color.Red, 0.0f, true);
// Draw an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect);
// Scale the LinearGradientBrush.
myLGBrush.ScaleTransform(2.0f, 1.0f, MatrixOrder.Prepend);
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-20.0f, 0.0f);
// Draw a second ellipse to the screen using
// the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100);
}
Public Sub ScaleTransformExample(ByVal e As PaintEventArgs)
' Create a LinearGradientBrush.
Dim myRect As New Rectangle(20, 20, 200, 100)
Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
Color.Red, 0.0F, True)
' Draw an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect)
' Scale the LinearGradientBrush.
myLGBrush.ScaleTransform(2.0F, 1.0F, MatrixOrder.Prepend)
' Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-20.0F, 0.0F)
' Draw a second ellipse to the screen using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100)
End Sub
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應