Solved

Copying bmps to to TImage

Posted on 2000-05-12
5
311 Views
Last Modified: 2010-04-04
Hi,

I think one of my marbles is a bit loose!:-)

I am trying to copy a section of a bmp from a TImage to another TImage using CopyRect. Why can I only see the copied image if I have an existing bmp in the destination TImage? I addition the copied bmp will only overlay the parts of the image currently covered by the existing bmp.

How can I just copy the section of the source bmp in the TImage to the destination TImage with no pre-existing bmp?

Regards

Chris
0
Comment
Question by:ChrisBerry
[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
5 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 50 total points
ID: 2804013
Have you set the dimensions of the destination bitmap before you did the copy?

Image1.Picture.Bitmap.Width := ...

The Neil =:)
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 2804134
ChrisBerry

Does your code look anything like this, cause I just wrote this and it worked fine

var
  Bitmap: TBitmap;
  FirstRect, OtherRect: TRect;
begin
  FirstRect := Rect(0, 0, 10, 10);
  OtherRect := Rect(10, 10, 30, 30);
  Bitmap := TBitmap.Create;
  Bitmap.LoadFromFile('c:\windows\bubbles.bmp');
Form1.Canvas.CopyRect(OtherRect, Bitmap.Canvas, FirstRect);
  Bitmap.Free;
end;

Later
BoRiS
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2804997
Hi BoRiS, nice to see you...   :-)
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 2805013
Hi Madshi

Good to be back ;-)

Later
BoRiS
0
 

Author Comment

by:ChrisBerry
ID: 2806423
Hi all,

Thanks for your replies.

Neil was right, I was setting the TImage width/height not the bitmap.

BoRiS, yes I did get that to work. My problem was with TImage not form canvas.

Thanks

Chris
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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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