Solved

How to swap to images?

Posted on 2002-03-06
4
152 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

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 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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now