Matrix.Scale 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 le vecteur d'échelle spécifié à ce Matrix en l'ajoutant au début.
Surcharges
Scale(Single, Single) |
Applique le vecteur d'échelle spécifié à ce Matrix en l'ajoutant au début. |
Scale(Single, Single, MatrixOrder) |
Applique le vecteur d'échelle spécifié ( |
Scale(Single, Single)
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
Applique le vecteur d'échelle spécifié à ce Matrix en l'ajoutant au début.
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)
Paramètres
Exemples
Pour obtenir un exemple, consultez Scale(Single, Single, MatrixOrder).
S’applique à
Scale(Single, Single, MatrixOrder)
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
Applique le vecteur d'échelle spécifié (scaleX
et scaleY
) à ce Matrix dans l'ordre spécifié.
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)
Paramètres
- order
- MatrixOrder
MatrixOrder qui spécifie l'ordre (ajout au début ou à la fin) dans lequel le vecteur d'échelle est appliqué à ce Matrix.
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, un objet d’événementPaint. Le code effectue les actions suivantes :
Dessine un rectangle à l’écran avant d’appliquer une transformation de mise à l’échelle (rectangle bleu).
Crée une matrice et la met à l’échelle de 3 dans l’axe x et de 2 dans l’axe y.
Applique cette transformation de matrice au rectangle.
Dessine le rectangle transformé à l’écran (rectangle rouge).
Notez que le rectangle rouge a été mis à l’échelle d’un facteur de 3 dans l’axe x et de 2 dans l’axe y, y compris le coin supérieur gauche du rectangle (le point de départ du rectangle).
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
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