I am new to Delphi - in spite of looking at numerous text books, I cannot find a simple way of printing a screen shoot. Is there one?

If you mean printing the form you are viewing the answer is yes. Every form has one property and one procedure (method) to print a form.

First make sure the PrintScale property is set to poPrintToFit. This will ensure that the is resized to fit on whatever printer is the default. Otherwise when you print the form it might come out on more than one sheet of paper and be cut off.

Next drop a button on your form and execute the form's print method like this:

procedure TYourFormsName.btn_printClick(Sender: TObject);
begin
self.print;
end;

Hope this helps.

Thanks for the advice which has helped in part. All the labels and other Delphi components have been printed, but I had also produced some lines using the canvas.lineto command. Although present on the screen, they have not printed. The main aim is to produce a graph like object from data captured in real time. I have sufficient experience to produce the hardware to produce the data and now need to display it. What puzzles me is that there appears to be such problems in printing the contents of the screen.

The screen print method that I referred to will print the form and all children of the form. I'm just guessing, but if you have overlaid a canvas over the form, but it doesn't belong to the form (i.e. is not a child of the form) then that may be why it is not printing. It's been a while since I've worked directly with canvases.

Good luck.

Member Avatar for Micheus

All the labels and other Delphi components have been printed, but I had also produced some lines using the canvas.lineto command. Although present on the screen, they have not printed. The main aim is to produce a graph like object from data captured in real time.

lespitts, may be this help You, but could it not be a better solution.

It is equivalente to press key Print Screen (screen shot):
Keybd_Event(VK_Snapshot, 0, 0, 0);

It is equivalente to press key Alt + Print Screen (active window shot):
Keybd_Event(VK_Snapshot, 1, 0, 0);

Bye

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.