SetStartCap

Pen.SetStartCap method

Applies to: desktop apps only

The Pen::SetStartCap method sets the start cap for this Pen object.

Syntax

Status SetStartCap(
  [in]  LineCap startCap
);

Parameters

startCap [in]

Type: LineCap

Element of the LineCap enumeration that specifies the start cap of a 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, sets the start cap, and draws a line. The code then resets the start cap, draws a second line, resets the start cap again, and draws a third line.


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

   // Create a pen.
   Pen pen(Color(255, 0, 0, 255), 15);

   // Set the start cap of the pen, and draw a line.
   pen.SetStartCap(LineCapArrowAnchor);
   graphics.DrawLine(&pen, 50, 50, 400, 150);

   // Reset the start cap, and draw a second line.
   pen.SetStartCap(LineCapTriangle);
   graphics.DrawLine(&pen, 50, 80, 400, 180); 

   // Reset the start cap, and draw a third line.
   pen.SetStartCap(LineCapRound);
   graphics.DrawLine(&pen, 50, 110, 400, 210);   
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdipluspen.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Pen
Pen::GetEndCap
Pen::GetStartCap
LineCap
Pen::SetEndCap
Pen::SetLineCap
Drawing a Line with Line Caps
Pens, Lines, and Rectangles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2016 Microsoft