Solved

Select part of a Image

Posted on 1998-11-24
4
162 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 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

Independent Software Vendors: 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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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