it is possible with the help of GDI functions. Refer MSDN for most of the details with examples. Also refer CDC class in MFC;

all the best!