Pen.GetCustomStartCap method

Applies to: desktop apps only

The Pen::GetCustomStartCap method gets the custom start cap currently set for this Pen object.

Syntax

Status GetCustomStartCap(
  [out]  CustomLineCap *customCap
);

Parameters

customCap [out]

Type: CustomLineCap*

Pointer to a CustomLineCap object that receives the start cap of this Pen object.

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 GraphicsPath object and adds a rectangle to it. The code then creates a Pen object, sets the custom start cap using the GraphicsPath object, and draws a line. Finally, the code gets the custom start cap of the pen and creates another Pen object using the same custom end cap. It then draws a second line.


VOID Example_GetCustomStartCap(HDC hdc)
{
   Graphics graphics(hdc);
   GraphicsPath strokePath;
   strokePath.AddRectangle(Rect(-10, -5, 20, 10));

  // Create a pen with a custom start cap.
   Pen pen(Color(255, 0, 0, 255));
   CustomLineCap custCap(NULL, &strokePath);
   pen.SetCustomStartCap(&custCap);

   graphics.DrawLine(&pen, 50, 50, 200, 100);

   // Obtain the custom start cap for the pen.
   CustomLineCap customLineCap(NULL, NULL);
   pen.GetCustomStartCap(&customLineCap);

   // Create another pen, and use the same custom start cap.
   Pen pen2(Color(255, 0, 255, 0), 3);
   pen2.SetCustomStartCap(&customLineCap);

   graphics.DrawLine(&pen2, 50, 100, 200, 150);
}

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::GetCustomEndCap
Pen::SetCustomEndCap
Pen::SetCustomStartCap
Drawing a Custom Dashed Line
Pens, Lines, and Rectangles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Show: