PathGradientBrush.ScaleTransform Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt de lokale geometrische transformatie geschaald op basis van de opgegeven hoeveelheden. Met deze methode wordt de schaalmatrix voorafgegaan aan de transformatie.
Overloads
| Name | Description |
|---|---|
| ScaleTransform(Single, Single) |
Hiermee wordt de lokale geometrische transformatie geschaald op basis van de opgegeven hoeveelheden. Met deze methode wordt de schaalmatrix voorafgegaan aan de transformatie. |
| ScaleTransform(Single, Single, MatrixOrder) |
Hiermee wordt de lokale geometrische transformatie geschaald op basis van de opgegeven hoeveelheden in de opgegeven volgorde. |
ScaleTransform(Single, Single)
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
Hiermee wordt de lokale geometrische transformatie geschaald op basis van de opgegeven hoeveelheden. Met deze methode wordt de schaalmatrix voorafgegaan aan de transformatie.
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)
Parameters
- sx
- Single
De transformatieschaalfactor in de richting van de x-as.
- sy
- Single
De transformatieschaalfactor in de richting van de y-as.
Voorbeelden
Zie ScaleTransformvoor een voorbeeld.
Van toepassing op
ScaleTransform(Single, Single, MatrixOrder)
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
- Bron:
- PathGradientBrush.cs
Hiermee wordt de lokale geometrische transformatie geschaald op basis van de opgegeven hoeveelheden in de opgegeven volgorde.
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)
Parameters
- sx
- Single
De transformatieschaalfactor in de richting van de x-as.
- sy
- Single
De transformatieschaalfactor in de richting van de y-as.
- order
- MatrixOrder
Een MatrixOrder die aangeeft of de schaalmatrix moet worden toegevoegd of voorbereid.
Voorbeelden
Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een OnPaint-gebeurtenisobject. De code
Hiermee maakt u een grafisch pad en voegt u er een rechthoek aan toe.
Hiermee maakt u een PathGradientBrush van de padpunten (in dit voorbeeld vormen de punten een rechthoek, maar dit kan de meeste vormen zijn).
Hiermee stelt u de middelste kleur in op rood en de omringende kleur op blauw.
Hiermee tekent u het PathGradientBrush scherm voordat u de schaaltransformatie toepast.
Hiermee past u de schaaltransformatie toe op het kwast met behulp van de ScaleTransform methode.
Roept de TranslateTransform methode aan om de kwastrechthoek zodanig te verplaatsen dat deze de rechthoek die eerder op het scherm is getekend, niet overlayt.
Hiermee tekent u de vertaalde kwastrechthoek naar het scherm.
U ziet dat de onderste rechthoek twee keer zo lang is als de x-as die vóór de vertaling is getekend.
public:
void ScaleTransformExample( PaintEventArgs^ e )
{
// Create a graphics path and add a rectangle.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle rect = Rectangle(100,20,100,50);
myPath->AddRectangle( rect );
// Get the path's array of points.
array<PointF>^myPathPointArray = myPath->PathPoints;
// Create a path gradient brush.
PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );
// Set the color span.
myPGBrush->CenterColor = Color::Red;
array<Color>^ mySurroundColor = {Color::Blue};
myPGBrush->SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to transformation.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );
// Scale by a factor of 2 in the x-axis by applying the scale
// transform to the brush.
myPGBrush->ScaleTransform( 2, 1, MatrixOrder::Append );
// Move the brush down by 100 by Applying the translate
// transform to the brush.
myPGBrush->TranslateTransform( -100, 100, MatrixOrder::Append );
// Draw the brush to the screen again after applying the
// transforms.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
}
public void ScaleTransformExample(PaintEventArgs e)
{
// Create a graphics path and add a rectangle.
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(100, 20, 100, 50);
myPath.AddRectangle(rect);
// Get the path's array of points.
PointF[] myPathPointArray = myPath.PathPoints;
// Create a path gradient brush.
PathGradientBrush myPGBrush = new
PathGradientBrush(myPathPointArray);
// Set the color span.
myPGBrush.CenterColor = Color.Red;
Color[] mySurroundColor = {Color.Blue};
myPGBrush.SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
// Scale by a factor of 2 in the x-axis by applying the scale
// transform to the brush.
myPGBrush.ScaleTransform(2, 1, MatrixOrder.Append);
// Move the brush down by 100 by Applying the translate
// transform to the brush.
myPGBrush.TranslateTransform(-100, 100, MatrixOrder.Append);
// Draw the brush to the screen again after applying the
// transforms.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub ScaleTransformExample(ByVal e As PaintEventArgs)
' Create a graphics path and add a rectangle.
Dim myPath As New GraphicsPath
Dim rect As New Rectangle(100, 20, 100, 50)
myPath.AddRectangle(rect)
' Get the path's array of points.
Dim myPathPointArray As PointF() = myPath.PathPoints
' Create a path gradient brush.
Dim myPGBrush As New PathGradientBrush(myPathPointArray)
' Set the color span.
myPGBrush.CenterColor = Color.Red
Dim mySurroundColor As Color() = {Color.Blue}
myPGBrush.SurroundColors = mySurroundColor
' Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)
' Scale by a factor of 2 in the x-axis by applying the scale
' transform to the brush.
myPGBrush.ScaleTransform(2, 1, MatrixOrder.Append)
' Move the brush down by 100 by Applying the translate
' transform to the brush.
myPGBrush.TranslateTransform(-100, 100, MatrixOrder.Append)
' Draw the brush to the screen again after applying the
' transforms.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub