Pen::GetAlignment method (gdipluspen.h)
The Pen::GetAlignment method gets the alignment currently set for this Pen object.
PenAlignment GetAlignment();
Type: PenAlignment
This method returns an element of the PenAlignment enumeration that indicates the current alignment setting for this Pen object.
The default value of PenAlignment is PenAlignmentCenter.
The following example creates a Pen object, sets the alignment, draws a line, and then gets the pen alignment settings.
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.
}
Requirement | Value |
---|---|
Minimum supported client | Windows XP, Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | gdipluspen.h (include Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |