• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

drawing not printed

Hi,
I have a form with some drawing on it (using LineTo();) and I'd like to print it, but when I call form1.print, I see just the empty form without the lines. Why is that and how can I resolve it?

thanks in advance
G
0
thegroover
Asked:
thegroover
  • 2
  • 2
1 Solution
 
ArhiCoderCommented:
Hi, try use function
GetFormImage(): TBitmap;
to get form imege to TBitmap class, then print it.
0
 
thegrooverAuthor Commented:
didn't work, here is the source:

procedure TForm1.printfrm;
var FormImage: TBitmap;
begin
  FormImage:=GetFormImage;
  print;
end;
0
 
ArhiCoderCommented:
Now I see. You just must repaint all your lines in OnPaint event, like this:

procedure TForm1.Button2Click(Sender: TObject);
begin
    Print;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
    Canvas.MoveTo(0,0);
    Canvas.LineTo(100,100);
end;
0
 
thegrooverAuthor Commented:
this will do it, thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now