Solved

Select part of a Image

Posted on 1998-11-24
4
160 Views
Last Modified: 2011-09-20
How can I select part of a picture in a Image, say Image1
then cut that part of the image to the clipboard.
0
Comment
Question by:Asw
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
rene100 earned 50 total points
ID: 1347771
hi

you can use the tcanvas.copyrect method. As TargetCanvas, you can use a run-time created TImage and copy this with the
TClipboard.assign to the clipboard.

reagards
rene
0
 
LVL 1

Author Comment

by:Asw
ID: 1347772
Hi Reen100,

Any chance of a snippet of code;

Andy
0
 
LVL 2

Expert Comment

by:rene100
ID: 1347773
ok, here's the example. As you can see, I use a TBitmpa instead of a second TImage.

uses clipbrd;

procedure TForm1.Button2Click(Sender: TObject);
var
Bitmap: tbitmap;
rect1,rect2: trect;
begin
Bitmap:=tbitmap.create;
rect2.top:=10;  //*Define the area to be copied
rect2.left:=10;
rect2.Right:=100;
rect2.Bottom:=100; //**

//Define where in bitmap the copied part of Image1 should be
rect1.top:=0;
rect1.left:=0;
rect1.Right:=90;
rect1.Bottom:=90;

Bitmap.width:=100; //Very important! if you forget this, it will
Bitmap.height:=100;//it will not work!

Bitmap.Canvas.CopyRect(rect1,image1.canvas,rect2);//Copy to Bmp
clipboard.Assign(Bitmap);//Copy to the clipboard
Bitmap.free;
end;

regards

rene
0
 
LVL 1

Author Comment

by:Asw
ID: 1347774
Thanks Rene100,

The points are yours
Andy

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now