Page 1 of 1

Black pages in TPrintPreview

PostPosted: March 7th, 2007, 3:00 pm
by andrews812
Hello!
I found weird problem with TPP in my application.

I use PaintGraphicEx method to draw a bitmap from TImage object.
It's often (9 of 10 times) when i draw about 10+ pages i got pages filled in black in printable area instead a bitmap which i draw.
I absolutely can't understand what happening and can't provide more information. It's hard for me to debug TPP's internal functions :cry:

I tried to save my bitmaps to file with TBitmap::SaveToFile() method
and opened it with picture viewer, and they displayed ok, so i can say that source bitmaps which i specify to PaintGraphicEx are "correct".
I'll be so happy if somebody can help me. Thank you!

I use C++ Builder 6 Enterprise + TPrintPreview v4.71

PostPosted: March 9th, 2007, 8:03 pm
by Kambiz
Could you please post here your code for page creation?

PostPosted: March 12th, 2007, 3:43 pm
by andrews812
my code is complicated and relatively big, so i attached my CreatePages() method to this post.

some words to simplify understanding of what i draw:
1. text header with TCanvas::TextOut() method
2. VirtualStringTree (very useful component from http://www.soft-gems.net/VirtualTreeview) with tree header on each page
3. standard TChart component

unfortunatelly i can't emitate such situation with simple test application...

PostPosted: March 13th, 2007, 12:19 pm
by Kambiz
For creat the temporary bitmaps please use TBitmap object instead of TImage.

Hope that it fixes the problem.

PostPosted: March 14th, 2007, 10:17 am
by andrews812
Unfortunatelly not :(

PostPosted: March 14th, 2007, 8:52 pm
by Kambiz
Your sample code seems to be okay. I don't know what could be wrong, sorry. :(

PostPosted: April 3rd, 2007, 3:13 pm
by andrews812
it seems i localized the problem..
When i point object type of TImage or TBitmap to PaintGraphicEx, it rendered in black pages. When i point object type of TMetafile it rendered ok.

It's happening exactly in my application which contains lot of controls, components,forms, WinXP themes support etc... In my simple test application i have no such problem. I can't explain this situation... :?

But, by rendering a TMetafile with PaintGraphicEx i got weird image distortion. Image doesn't fit all page area and looks like compressed (zoomed out with all flags set to false and zoomed in with Proportional set to true, distorted). It's another weird thing (exactly with TMetafile) :)