TextPen Class Reference

Class for control of the text color lifetime. More...

List of all members.

Public Member Functions

 TextPen (Canvas &canvas, COLORREF color)
 Constructor taking a Canvas and a COLORREF.
 ~TextPen ()
 Automatically restores the old TextColor.


Detailed Description

Class for control of the text color lifetime.

Constructor takes a COLORREF. (Use the RGB macro.
Class ensures that the previous text color is restored on object destruction.
Related classes


Constructor & Destructor Documentation

TextPen ( Canvas canvas,
COLORREF  color 
)

Constructor taking a Canvas and a COLORREF.

Build a COLORREF argument with windows.h's RGB( red, green, blue )

~TextPen (  ) 

Automatically restores the old TextColor.

Since this is a RAII structure it ensures the old pen is restored upon destruction. Be careful though since if this oulives the Canvas object given undefined behaviour will occur!

Back to SmartWin website
SourceForge.net Logo