OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Accessing TPen

You can access TPen through an HPEN or as a LOGPEN structure.

To get an HPEN from a TPen object, use the HPEN() operator with the TPen object as the parameter. The HPEN() operator is almost never explicitly invoked.

{
return pen;
}

This code automatically invokes the HPEN() conversion operator to cast the TPen object to the correct type.

To convert a TPen object to a LOGPEN structure, use the TPen::GetObject function:

{
TPen pen(TColor::LtMagenta, 10);
return pen.GetObject(logPen);
}

The following example shows how to use a pen with a TDC to draw a line: void

TPenDemo::DrawLine(TDC& dc, const TPoint& point, TColor& color)
{
dc.SelectObject(BrushPen);
dc.LineTo(point);
}

See Also