View Single Post
Old Feb 22nd, 2005, 5:49 PM   #1
jarrod
Newbie
 
Join Date: Feb 2005
Posts: 1
Rep Power: 0 jarrod is on a distinguished road
Printing rich text with colored background

Hello,

I am displaying the contents of a rich text control on the printer using the EM_FORMATRANGE message. I would like for the text to be drawn over a colored background. However, it appears that during the processing of the EM_FORMATRANGE message a white rectangle gets drawn behind the text, spanning the width of the bounding rectangle and extending down to the last line of text. I have tried setting the background color of the graphics device context using SetBkColor, tried setting the background brush of the rich text control's client area using SetWindowLong, and tried changing the character format of the control using the EM_SETCHARFORMAT message. While changing the character format does draw the correct background color behind the printed text, the white rectangles still appear.

Maybe I'm doing something wrong, but I'm about to give up on the EM_FORMATRANGE message and draw the text myself. Does anybody know of the correct way to draw rich text over an arbitrary color?

BTW: If I draw to a bitmap, everything works fine.

Thanks in advance,
Jarrod
jarrod is offline   Reply With Quote