Solved

How to swap to images?

Posted on 2002-03-06
4
155 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
[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
  • 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

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 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