?
Solved

Print a Control to an Image and Copy to ClipBoard??

Posted on 1998-10-14
3
Medium Priority
?
359 Views
Last Modified: 2010-04-06
I'm having some dificulty following the way Delphi prints and uses the clipboard. I am trying to do the following:

1. Print a control to an image.
2. Copy that image (in whatever format) to clipboard.

In Visual Basic it works like this:

myControl.PrinterHDC = Picture1.hDC
Picture1.Refresh
Clipboard.Clear
Clipboard.SetData Picture1.Image

In Delphi I have been trying to use the Image1.Canvas.Handle, but have not been able to get it to work.

Any help would be greatly appreciated.

Sincerely,

-S
0
Comment
Question by:summerset
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Thaddy earned 280 total points
ID: 1342838
if the control in question is just a form, you can use getformimage to obtain a bitmap representation of the form in  a Timage, and use copytoclipboard or assign to put it there
procedure TForm1.Button1Click(Sender: TObject);

var
  FormImage: TBitmap;
begin
  FormImage := GetFormImage;
try
  Clipboard.Assign(FormImage);
  Image1.Picture.Assign(Clipboard);
finally
  FormImage.Free;
end;
end;


0
 

Author Comment

by:summerset
ID: 1342839
Works great! If I want to save the picture to a file...should I just save from the clipboard then?

-S
0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1342840
You can just 'savetofile' from the Timage.picture.
See the onlne help on Tpicture. You might find even more that you like...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question