PathGradientBrush.RotateTransform Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Applique une rotation égale à l'angle spécifié, dans le sens des aiguilles d'une montre, à la transformation géométrique locale.
Surcharges
RotateTransform(Single) |
Fait pivoter la transformation géométrique locale conformément à la valeur spécifiée. Cette méthode ajoute la rotation avant la transformation. |
RotateTransform(Single, MatrixOrder) |
Fait pivoter la transformation géométrique locale conformément à la valeur et à l'ordre spécifiés. |
RotateTransform(Single)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
Fait pivoter la transformation géométrique locale conformément à la valeur spécifiée. Cette méthode ajoute la rotation avant la transformation.
public:
void RotateTransform(float angle);
public void RotateTransform (float angle);
member this.RotateTransform : single -> unit
Public Sub RotateTransform (angle As Single)
Paramètres
- angle
- Single
Angle (étendue) de la rotation.
Exemples
Pour obtenir un exemple, consultez RotateTransform.
S’applique à
RotateTransform(Single, MatrixOrder)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
Fait pivoter la transformation géométrique locale conformément à la valeur et à l'ordre spécifiés.
public:
void RotateTransform(float angle, System::Drawing::Drawing2D::MatrixOrder order);
public void RotateTransform (float angle, System.Drawing.Drawing2D.MatrixOrder order);
member this.RotateTransform : single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub RotateTransform (angle As Single, order As MatrixOrder)
Paramètres
- angle
- Single
Angle (étendue) de la rotation.
- order
- MatrixOrder
MatrixOrder qui spécifie si la matrice de rotation doit être ajoutée avant ou après.
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, un objet d’événementOnPaint. Le code effectue les actions suivantes :
Crée un chemin d’accès graphique et y ajoute un rectangle.
Crée un PathGradientBrush à partir des points de chemin d’accès (dans cet exemple, les points forment un rectangle, mais il peut s’agir de n’importe quelle forme).
Définit la couleur centrale sur le rouge et la couleur environnante sur le bleu.
Dessine le PathGradientBrush vers l’écran avant d’appliquer la transformation de rotation.
Applique la transformation pivotée au pinceau à l’aide de sa RotateTransform méthode.
Dessine le pinceau pivoté (rectangle) vers l’écran.
Notez que le rectangle inférieur est pivoté de 45 degrés par rapport à celui dessiné avant la traduction.
public:
void RotateTransformExample( PaintEventArgs^ e )
{
// Create a graphics path and add an ellipse.
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 );
// Apply the rotate transform to the brush.
myPGBrush->RotateTransform( 45, MatrixOrder::Append );
// Draw the brush to the screen again after applying the
// transform.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
}
public void RotateTransformExample(PaintEventArgs e)
{
// Create a graphics path and add an ellipse.
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);
// Apply the rotate transform to the brush.
myPGBrush.RotateTransform(45, MatrixOrder.Append);
// Draw the brush to the screen again after applying the
// transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
Public Sub RotateTransformExample(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)
' Apply the rotate transform to the brush.
myPGBrush.RotateTransform(45, MatrixOrder.Append)
' Draw the brush to the screen again after applying the
' transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour