Share via


Pen::GetAlignment, méthode (gdipluspen.h)

La méthode Pen::GetAlignment obtient l’alignement actuellement défini pour cet objet Pen .

Syntaxe

PenAlignment GetAlignment();

Valeur de retour

Type : PenAlignment

Cette méthode retourne un élément de l’énumération PenAlignment qui indique le paramètre d’alignement actuel de cet objet Pen .

Notes

La valeur par défaut de PenAlignmentCenter est PenAlignmentCenter.

Exemples

L’exemple suivant crée un objet Pen , définit l’alignement, dessine une ligne, puis obtient les paramètres d’alignement du stylet.

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

   // Create a Pen object and set its alignment.
   Pen pen(Color(255, 0, 255, 0), 15);
   pen.SetAlignment(PenAlignmentCenter);

   // Draw a line.
   graphics.DrawLine(&pen, 0, 0, 100, 50);

   // Obtain information about the Pen object.
   PenAlignment penAlignment;
   penAlignment = pen.GetAlignment();

   if(penAlignment == PenAlignmentCenter)
      ;  // The pixels will be centered on the theoretical line.
   else if(penAlignment == PenAlignmentInset)
      ;  // The pixels will lie inside the filled area  of the theoretical line.
}

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

Stylet

Pen::SetAlignment

PenAlignment

Stylos, lignes et rectangles

Définition de la largeur et de l’alignement du stylet