 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ed Dressel Guest
|
Posted: Wed Apr 07, 2004 11:50 pm Post subject: Simple Slide Show |
|
|
I've tried to create a simple slide show for showing *.jpg files found in a
selected directory, but what seems should be easy is in fact not: inbetween
images (I have two images (TImage) for buffering the up coming slide and
load the image in a separate thread). Switching between the two images can
sometimes take a moment, othertimes its quick.
My code is quite clean, using a timer it just toggles the visiblity of two
images (calling SendToBack removes some flicker, but I still get dead spots
inbetween showing the images):
if not Image1.Visible then
begin
Image1.SendToBack;
Image1.Visible := True;
Image2.Visible := False;
end
else
begin
Image2.SendToBack;
Image2.Visible := True;
Image1.Visible := False;
end;
I also tried LockWindowHandle before calling the code above and that
guarentees that the flicker will occur.
Any easy way of removing the flicker?
Thanks
Ed Dressel
|
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Thu Apr 08, 2004 12:11 am Post subject: Re: Simple Slide Show |
|
|
What about using just one TImage?
You can easily load a JPEG in a TBitmap, using something like
procedure LoadJpegInBitmap(Name: string; Bitmap: TBitmap);
begin
AJpeg := TJpegImage.Create;
try
AJpeg.LoadFromFile(Name);
Bitmap.Assign(AJpeg);
finally
AJpeg.Free;
end;
end;
Next, when you have the bitmap, you can simply assign it to the image:
Image1.Picture.Bitmap.Assign(MyBitmap);
This should reduce flicker. You can reuse MyBitmap or create it before each
load as you wish.
An additional way to reduce flicker is by setting Image1.DoubleBuffered :=
True;
Kind regards,
Nils Haeck
www.simdesign.nl
"Ed Dressel" <none> wrote
| Quote: | I've tried to create a simple slide show for showing *.jpg files found in
a
selected directory, but what seems should be easy is in fact not:
inbetween
images (I have two images (TImage) for buffering the up coming slide and
load the image in a separate thread). Switching between the two images can
sometimes take a moment, othertimes its quick.
My code is quite clean, using a timer it just toggles the visiblity of two
images (calling SendToBack removes some flicker, but I still get dead
spots
inbetween showing the images):
if not Image1.Visible then
begin
Image1.SendToBack;
Image1.Visible := True;
Image2.Visible := False;
end
else
begin
Image2.SendToBack;
Image2.Visible := True;
Image1.Visible := False;
end;
I also tried LockWindowHandle before calling the code above and that
guarentees that the flicker will occur.
Any easy way of removing the flicker?
Thanks
Ed Dressel
|
|
|
| Back to top |
|
 |
Uwe Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|