tags:

views:

16

answers:

1

Is it possible to change the custom pen colour attribute after creating it using this call?

HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); //Create a solid pen.

or how should i create a pen whose colour colour can be changed.

A: 

I am afraid that this is not possible using any non-esoteric approach.

I think, however, that you can use the DC_PEN stock object and the SetDCPenColor function, like so:

SelectObject(dc, GetStockObject(DC_PEN));
SetDCPenColor(dc, clGreen);
Rectangle(dc, 10, 10, 200, 200);
SetDCPenColor(dc, clRed);
Rectangle(dc, 300, 300, 500, 500);

in Delphi syntax.

Andreas Rejbrand