Главная страница | назад





Article #16001: Changing printer font styles

 Question and Answer Database
FAQ1001C.txt Changing printer font styles
Category :VCL
Platform :All
Product :C++Builder 1.x
Question:
How do I change the font style for text which is being directed
to the printer?
I tried this:
Canvas->Font->Style << fsBold;
Canvas->TextOut (20, 20, "Hello");
Canvas->Font->Style>> fsBold;
which compiles and makes the font on the screen bold,
but doesn't make the font on the printer bold. Yet the
equivalent Pascal code works. What do I need to do?
Answer:
Rather than inserting into the Font->Style set,
you need to create a TFontStyles, insert the values you
want into that set, and then set the Font->Style
set equal to it, as follows:
TFontStyles printer_styles;
printer_styles << fsBold;
Canvas->Font->Style = printer_styles;
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99