views:

916

answers:

3

I have a winform app which render a few charts, based on the user selection. I want to simulate an ajax style loader such that when the user makes a selection, there will be an overlay on the form with an animation in the center. What are some of the options in accomplishing this? I was thinking of loading a panel with the animation (gif) in the center, add some opacity.

Edit ~ Anyone?

Edit ~ Here is solution I found...finally! No WPF nonesense.

A: 

WinForms is pretty weak for this sort of thing -- WPF handles situations like this a lot better. You could do a couple of things:

1) HACK! Create a new modeless, borderless form, containing your wait control, and put that over your existing form. AFAIK you can't assign transparency to any of the out-of-the-box WinForms controls. Ensure that when your existing form moves, your new form moves. This is a total hack.

2) Create your own WinForms control from scratch and have it paint over your existing form. High cost to reward ratio.

3) Use WPF for this form, which will allow you a lot more flexibility. That's a whole new framework... Just for one form?

4) Hide the chart temporarily and just make your progress panel look really pretty.

Dave Markle
A: 

WinForms's PictureBox control cannot handle animated gifs.

You can still use PictureBox but flip through frames by yourself. Simply set Timer every 50 or 100ms to keep rotating frames on picture box.

To create overlay, I would try black panel that will cover whole form with some alpha value. It won't work on anything lower than Windows XP though. If I remember correctly, Windows 2000 and lower cannot handle transparency in Winforms.

lubos hasko
Actually, the WinForms PictureBox can handle animated GIFs perfectly.
SLaks
A: 

As Saif already said these are full customizable Loaders:

http://www.codeproject.com/KB/cs/mrg_loadingcircle.aspx

Oliver