Solved

How to swap to images?

Posted on 2002-03-06
4
153 Views
Last Modified: 2010-04-05
Hi

Problem: How to swap images ?

Info: 1 form  with  3 Image components and 1 BitButton
      Procedure bellow swaps images and works OK
 
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  Image3.Picture.Bitmap := Image1.Picture.Bitmap;
  Image1.Picture.Bitmap := Image2.Picture.Bitmap;
  Image2.Picture.Bitmap := Image3.Picture.Bitmap;
end;

To Do: i need procedure which will be like this one bellow,
       btw: procedure is not working  
 
procedure TForm1.BitBtn1Click(Sender: TObject);
var
   imgTemp: TBitmap;
begin
  imgTemp := Image1.Picture.Bitmap;
  Image1.Picture.Bitmap := Image2.Picture.Bitmap;
  Image2.Picture.Bitmap := imgTemp;
end;


Please, can anyone help me !
0
Comment
Question by:nosleep
  • 3
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 77 total points
ID: 6844076
use assign instead and create your tmpimage, like

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  imgTemp: TBitmap;
begin
 imgTmp := TBitmap.Create;
 try
   imgTemp.Assign(Image1.Picture.Bitmap);
   Image1.Picture.Bitmap.assign(Image2.Picture.Bitmap);
   Image2.Picture.Bitmap.assign(imgTemp);
 finally
   imgTmp.free
 end;
end;

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6844079
hu, 10 points :-(
not seen before
0
 

Author Comment

by:nosleep
ID: 6844609
OK, 77 points  for kretzchmar if good comment
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6844843
well, thats ok,
if my comment solves your problem,
then don't forget the grading

watch out for the button "accept answer" or similar
on the upper right of each comment

meikl ;-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 164
add combobox item based on numbers 9 154
creating threads in delphi 1 132
Base1 Encode/Decode 3 81
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
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…

860 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