Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to swap to images?

Posted on 2002-03-06
4
Medium Priority
?
157 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 308 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
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: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

721 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