Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Copying bmps to to TImage

Posted on 2000-05-12
5
Medium Priority
?
314 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 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