?
Solved

Select part of a Image

Posted on 1998-11-24
4
Medium Priority
?
164 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
[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
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
rene100 earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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