Méthode Pen::SetTransform (gdipluspen.h)

La méthode Pen::SetTransform définit la transformation mondiale de cet objet Pen .

Syntaxe

Status SetTransform(
  [in] const Matrix *matrix
);

Paramètres

[in] matrix

Type : matrice* const

Pointeur vers un objet Matrix qui spécifie la transformation du monde.

Valeur retournée

Type : État

Si la méthode réussit, elle retourne Ok, qui est un élément de l’énumération Status .

Si la méthode échoue, elle retourne l’un des autres éléments de l’énumération Status .

Notes

Cette méthode ignore la partie de traduction de l’objet Matrix .

Exemples

L’exemple suivant crée une matrice d’échelle et un objet Pen , puis dessine un rectangle. Le code met ensuite à l’échelle le stylet en fonction de la matrice et dessine un deuxième rectangle.

VOID Example_SetTransform(HDC hdc)
{
   Graphics graphics(hdc);

   Matrix matrix(20, 0, 0, 10, 0, 0);  // scale

   // Create a pen, and use it to draw a rectangle.
   Pen pen(Color(255, 0, 0, 255), 2);
   graphics.DrawRectangle(&pen, 10, 50, 150, 100);

   // Scale the pen width by a factor of 20 in the horizontal 
   // direction and a factor of 10 in the vertical direction.
   pen.SetTransform(&matrix);

   // Draw a rectangle with the transformed pen.
   graphics.DrawRectangle(&pen, 200, 50, 150, 100);
}

Configuration requise

   
Client minimal pris en charge Windows XP, Windows 2000 Professionnel [applications de bureau uniquement]
Serveur minimal pris en charge Windows 2000 Server [applications de bureau uniquement]
Plateforme cible Windows
En-tête gdipluspen.h (inclure Gdiplus.h)
Bibliothèque Gdiplus.lib
DLL Gdiplus.dll

Voir aussi

Systèmes de coordonnées et transformations

Matrice

Stylet

Pen::GetTransform

Pen::MultiplyTransform

Pen::ResetTransform

Stylet::RotateTransform

Pen::ScaleTransform

Transformations