mikepj
asked on
Problem with StretchDraw to a printer canvas
Hi,
I have a small problem using StretchDraw to the printer canvas. The problem is that the image is not visible when the report is printed on the printer or printed to Acrobat. This section of the code has been newly written. This has been seen on different computers with the same results.
The size and position are correct (I only know this because if I use CopyMode cmBlackness, the correct image size and location are evident. I know that the image was successfully loaded because I did a test StretchDraw to a TImage canvas (using different DrawRect) after the StretchDraw to the printer canvas and the image was visible.
I have tried various CopyModes without success. This has been primarily tested under Windows 98.
What is happening?
Thank you,
MP
LogoBitmap:=TBitmap.Create ;
With Printer.Canvas Do
Try
Try
LogoBitmap.LoadFromFile(Cf g.LogoName );
Except
ShowMessage('Error reading logo: '+Cfg.LogoName);
Exit;
End;
DrawRect:=...
CopyMode:=cmSrcCopy;
StretchDraw(DrawRect,LogoB itmap);
Finally
LogoBitmap.Free;
End;
I have a small problem using StretchDraw to the printer canvas. The problem is that the image is not visible when the report is printed on the printer or printed to Acrobat. This section of the code has been newly written. This has been seen on different computers with the same results.
The size and position are correct (I only know this because if I use CopyMode cmBlackness, the correct image size and location are evident. I know that the image was successfully loaded because I did a test StretchDraw to a TImage canvas (using different DrawRect) after the StretchDraw to the printer canvas and the image was visible.
I have tried various CopyModes without success. This has been primarily tested under Windows 98.
What is happening?
Thank you,
MP
LogoBitmap:=TBitmap.Create
With Printer.Canvas Do
Try
Try
LogoBitmap.LoadFromFile(Cf
Except
ShowMessage('Error reading logo: '+Cfg.LogoName);
Exit;
End;
DrawRect:=...
CopyMode:=cmSrcCopy;
StretchDraw(DrawRect,LogoB
Finally
LogoBitmap.Free;
End;
try this..
b := tbitmap.create;
b.loadfromfile('whatever') ;
drawrect := rect(0, 0, 100, 100);
printer.begindoc;
printer.canvas.stretchdraw (drawrect, b);
printer.enddoc;
b.free;
This might work.. try it out..
..-=ViKtOr=-..
b := tbitmap.create;
b.loadfromfile('whatever')
drawrect := rect(0, 0, 100, 100);
printer.begindoc;
printer.canvas.stretchdraw
printer.enddoc;
b.free;
This might work.. try it out..
..-=ViKtOr=-..
ASKER
Thank you for your message.
This was basically what I was doing. Epsylon's suggestion fixed the problem. VERY interesting!
If Epsylon could submit the comment as an answer, I would be pleased to accept the answer.
Thank you for your help!
MP
This was basically what I was doing. Epsylon's suggestion fixed the problem. VERY interesting!
If Epsylon could submit the comment as an answer, I would be pleased to accept the answer.
Thank you for your help!
MP
Thanks Mikepj, glad my suggestion helped you :o)
Cheers,
Epsylon.
Cheers,
Epsylon.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.delphidevelopers.com/delphi/faq/faqin/821.html