By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,372 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,372 IT Pros & Developers. It's quick & easy.

Animation for wait dialog

P: n/a
Most applications, including Windows Explorer, show some sort of
'wait' dialog with animation when a lengthy operation is going on. For
example, When the Windows Explorer is searching for something, it
shows a small dialog with a moving flashlight. I examined the
explorer.exe and found that that was an avi file.

Now that, I would like to do similar thing in my C# application. But
what is the most efficient way to do so?
1)Manually drawing animations on a form using .NET GDI+ methods :
could reduce resource usage.
2)Using animated GIF file : only requires a PictureBox
3)Using an avi file on a media player : high quality but it would take
a lot of time to load the media player, and a lot of resources.

I can't decide what is the best practice. Maybe all three schemes I'd
come up with are all wrong. Thank you for any advice.
Jul 5 '08 #1
Share this Question
Share on Google+
4 Replies

P: n/a
On Sat, 05 Jul 2008 06:53:13 -0700, Sin Jeong-hun <ty*******@gmail.com>
wrote:
Most applications, including Windows Explorer, show some sort of
'wait' dialog with animation when a lengthy operation is going on. For
example, When the Windows Explorer is searching for something, it
shows a small dialog with a moving flashlight. I examined the
explorer.exe and found that that was an avi file.

Now that, I would like to do similar thing in my C# application. But
what is the most efficient way to do so?
Define "efficient".

I'm pleasantly surprised to hear that the PictureBox control class
supports animated GIFs. I'd never tried that before, and I've seen other
areas of .NET where that level of functionality is "left as an exercise
for the reader". :) If you can get PictureBox to animate an animated
GIF, IMHO that's the best way to do it.

I doubt Windows Explorer actually loads the entire Windows Media Player
just to show the AVI you say it's using for its animation, so were you to
use an AVI, you'd either need to figure out the most lightweight way of
showing the AVI, or suffer a cost much greater than Windows Explorer does
for displaying. I don't know what you mean by "high quality"; an animated
GIF and a lossless-compressed AVI should be identical in quality.

The PictureBox approach requires the least amount of work, by _far_, and I
would be surprised if there's enough extra overhead to make it worth you
going to all the effort to implement the same functionality yourself. To
me, that makes it the obvious way to go.

Pete
Jul 5 '08 #2

P: n/a
On Jul 6, 1:25*am, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Sat, 05 Jul 2008 06:53:13 -0700, Sin Jeong-hun <typing...@gmail.com*
wrote:
Most applications, including Windows Explorer, show some sort of
'wait' dialog with animation when a lengthy operation is going on. For
example, When the Windows Explorer is searching for something, it
shows a small dialog with a moving flashlight. I examined the
explorer.exe and found that that was an avi file.
Now that, I would like to do similar thing in my C# application. But
what is the most efficient way to do so?

Define "efficient".

I'm pleasantly surprised to hear that the PictureBox control class *
supports animated GIFs. *I'd never tried that before, and I've seen other *
areas of .NET where that level of functionality is "left as an exercise *
for the reader". *:) *If you can get PictureBox to animate an animated *
GIF, IMHO that's the best way to do it.

I doubt Windows Explorer actually loads the entire Windows Media Player *
just to show the AVI you say it's using for its animation, so were you to*
use an AVI, you'd either need to figure out the most lightweight way of *
showing the AVI, or suffer a cost much greater than Windows Explorer does*
for displaying. *I don't know what you mean by "high quality"; an animated *
GIF and a lossless-compressed AVI should be identical in quality.

The PictureBox approach requires the least amount of work, by _far_, and I *
would be surprised if there's enough extra overhead to make it worth you *
going to all the effort to implement the same functionality yourself. *To *
me, that makes it the obvious way to go.

Pete
By "efficient" I mean less time to start the animation, and less
memory & CPU consumptions.
PictureBox does support animated GIFs but as you may know, GIF only
supports 256 colors. So it can't display soft true color animation.
I'm not sure but I think that avi embedded in the Windows Explorer
isn't like those you see on the Internet. I guess it's an uncompressed
avi that can be played by Windows API somehow, like BMP.
By "high quality" I mean high quality true color animation. For
example, the file copy dialog of Windows Vista shows very soft
animations. To show that quality animation to users, I wonder what
would professional C# developers do. That's why posted this. Using
Managed DirectX is also a good option?
Jul 5 '08 #3

P: n/a
On Sat, 05 Jul 2008 10:07:24 -0700, Sin Jeong-hun <ty*******@gmail.com>
wrote:
By "efficient" I mean less time to start the animation, and less
memory & CPU consumptions.
Well, an animated GIF is the best choice there. There's a direct
correlation between video quality and computational cost, in terms of both
the size of the code that has to be loaded and the amount of work it has
to do.
PictureBox does support animated GIFs but as you may know, GIF only
supports 256 colors. So it can't display soft true color animation.
That's true. But for better or worse, I don't think that on Windows,
people really expect 24-bit UI animations. :) I would actually expect a
256-bit GIF to be sufficient.
I'm not sure but I think that avi embedded in the Windows Explorer
isn't like those you see on the Internet. I guess it's an uncompressed
avi that can be played by Windows API somehow, like BMP.
Well, AVI is just a container format, actually. It's just a specialized
RIFF format. You'd have to look at the exact format to know exactly what
they're doing, but there are plenty of lossless video formats that can be
stored as AVI, including 24 bpp video.
By "high quality" I mean high quality true color animation. For
example, the file copy dialog of Windows Vista shows very soft
animations. To show that quality animation to users, I wonder what
would professional C# developers do. That's why posted this. Using
Managed DirectX is also a good option?
I haven't used Vista enough to have a good idea of what you're talking
about. The animations I see on XP would be fine as 8-bit. :)

As far as Managed DirectX, sure...that may in fact do very well for you.
Look at the AudioVideoPlayback class for a very easy-to-use video playback
component. At the very least, I think it should load faster than WMP. :)

Pete
Jul 6 '08 #4

P: n/a

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Sat, 05 Jul 2008 10:07:24 -0700, Sin Jeong-hun <ty*******@gmail.com>
wrote:
>By "efficient" I mean less time to start the animation, and less
memory & CPU consumptions.

Well, an animated GIF is the best choice there. There's a direct
correlation between video quality and computational cost, in terms of both
the size of the code that has to be loaded and the amount of work it has
to do.
>PictureBox does support animated GIFs but as you may know, GIF only
supports 256 colors. So it can't display soft true color animation.

That's true. But for better or worse, I don't think that on Windows,
people really expect 24-bit UI animations. :) I would actually expect a
256-bit GIF to be sufficient.
>I'm not sure but I think that avi embedded in the Windows Explorer
isn't like those you see on the Internet. I guess it's an uncompressed
avi that can be played by Windows API somehow, like BMP.

Well, AVI is just a container format, actually. It's just a specialized
RIFF format. You'd have to look at the exact format to know exactly what
they're doing, but there are plenty of lossless video formats that can be
stored as AVI, including 24 bpp video.
>By "high quality" I mean high quality true color animation. For
example, the file copy dialog of Windows Vista shows very soft
animations. To show that quality animation to users, I wonder what
would professional C# developers do. That's why posted this. Using
Managed DirectX is also a good option?

I haven't used Vista enough to have a good idea of what you're talking
about. The animations I see on XP would be fine as 8-bit. :)

As far as Managed DirectX, sure...that may in fact do very well for you.
Look at the AudioVideoPlayback class for a very easy-to-use video playback
component. At the very least, I think it should load faster than WMP. :)

Pete

Windows (XP) uses a native control called the Animation Control Library
(msdn: http://msdn.microsoft.com/en-us/libr...84(VS.85).aspx)
There is a great C# implementation available here:
http://www.codeproject.com/KB/miscctrl/CGAnimation.aspx
There are several limitations to the avi file format, see the msdn
documentation for full details:
An animation control can display an AVI clip originating from either an
uncompressed AVI file or from an AVI file that was compressed using
run-length (BI_RLE8) encoding. You can add the AVI clip to your application
as an AVI resource, or the clip can accompany your application as a separate
AVI file.

Note The AVI file, or resource, must not have a sound channel. The
capabilities of the animation control are very limited and are subject to
change.
The UI thread is running the animation so any work that you want to do while
'playing' the animation must happen in another thread. (e.g. using the
Backgroundworker control or Ascyn webservice calls).
I'm still looking for a tool that can compress the avi file.

Rudi
Jul 18 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.