grading
asked on
Print a rectangular-area on a form
I would like to print a part of a form. Can someone help me with that ?
ASKER
Hi Thaddy.
I have already tried your suggestion Form1.Print. This command is printing the complete form, but I want to print only a part of it.
My code is like this:
Form1.Image1.Picture.Graph ic := Form1.GetFormImage;
Printer.Canvas.Draw(xpos,y pos,Form1. Image1.Pic ture.Graph ic);
Nothing is being printed. What have I forgotten ?
I have already tried your suggestion Form1.Print. This command is printing the complete form, but I want to print only a part of it.
My code is like this:
Form1.Image1.Picture.Graph
Printer.Canvas.Draw(xpos,y
Nothing is being printed. What have I forgotten ?
Do not use the graphic property, but the BITMAP property instead
ASKER
I have tried the same code with Bitmaps, but with no luck. Please send me pease of code wich you know will work.
procedure TForm1.Button1Click(Sender : TObject);
begin
Form1.Image1.Picture.bitma p:=Form1.G etFormImag e;
Printer.BeginDoc;
Printer.Canvas.Draw(10,10, Form1.Imag e1.Picture .bitmap);
end;
begin
Form1.Image1.Picture.bitma
Printer.BeginDoc;
Printer.Canvas.Draw(10,10,
end;
Forgot to call printer.enddoc; as the last line! please add that.
ASKER
I have a 'Printer.BeginDoc' in front and a 'Printer.EndDoc' in the end. That is not the problem.
then the code i sent should work, at leat on my lexmark 1000 and on my HP4M, i tried it. maybe a printer driver problem?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you want to print just part of it, you can call getformimage to obtain a bitmap and manipulate that in a Timage (without stretch) to print just the part that shows in the Timage.