Pen.SetLineCap method
Applies to: desktop apps only
The Pen::SetLineCap method sets the cap styles for the start, end, and dashes in a line drawn with this pen.
Syntax
Status SetLineCap( [in] LineCap startCap, [in] LineCap endCap, [in] DashCap dashCap );
Parameters
- startCap [in]
-
Type: LineCap
Element of the LineCap enumeration that specifies the start cap of a line.
- endCap [in]
-
Type: LineCap
Element of the LineCap enumeration that specifies the end cap of a line.
- dashCap [in]
-
Type: DashCap
Element of the DashCap enumeration that specifies the start and end caps of the dashes in a dashed line.
Return value
Type:
Type: Status
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Examples
The following example creates a Pen object and sets the line caps. The code then sets the dash style for the pen and draws a line.
VOID Example_SetLineCap(HDC hdc)
{
Graphics graphics(hdc);
// Create a pen.
Pen pen(Color(255, 0, 0, 255), 15);
// Set line caps for the pen.
pen.SetLineCap(LineCapArrowAnchor, LineCapTriangle, DashCapRound);
// Set the dash style for the pen.
pen.SetDashStyle(DashStyleDash);
// Draw a line.
graphics.DrawLine(&pen, 50, 50, 420, 200);
}
Requirements
|
Minimum supported client | Windows XP, Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Product | GDI+ 1.0 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Pen
- Pen::GetEndCap
- Pen::GetStartCap
- LineCap
- Pen::SetCustomEndCap
- Pen::SetCustomStartCap
- Pen::SetEndCap
- Drawing a Line with Line Caps
- Pens, Lines, and Rectangles
Send comments about this topic to Microsoft
Build date: 3/6/2012