Solved

Copying bmps to to TImage

Posted on 2000-05-12
5
312 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 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