Solved

Using animated GIFs as "Please Wait" images

Posted on 2007-12-05
10
10,068 Views
Last Modified: 2010-04-21
I have an animated GIF that I would like to use in my VB .NET application when a process is running. It works fine with asynchronous tasks but the problem I have is with processor intensive tasks, the animation stops until the line of code has been executed.

I have a third party control on one of my forms and it takes two or three seconds to initialise, because I dont have access to the inner workings of the control I cannot use Application.DoEvents.

I have tried putting my GIF on a different form and loading it before the code line runs thinking that it may be on a different thread but it does the same thing.

I dont necessarily think this is a problem with the GIF as I have tried a progress bar in marquee mode, it too stops when it reaches the line of code.

Does anybody know how I can get around this?
0
Comment
Question by:3Si_pnewman
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
It looks like you need to use threading.
Thread Programming
 http://www.wilsonmar.com/1threads.htm

Threading in .NET Part 2
http://dotnetjunkies.com/Tutorial/5AEE38D7-2B4E-4FC7-8760-A8298F565A0C.dcik
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 150 total points
Comment Utility
You have to use a multi-threads.

Look this example http://support.microsoft.com/kb/315577
0
 
LVL 1

Author Comment

by:3Si_pnewman
Comment Utility
I have tried a couple of threading methods but I still cant get it to work, I think the control is locking foreground thread.

I have amended the Microsoft example slightly to try and replicate my problem, it can be found here http://files.filefront.com/ThreadWinAppzip/;9195002;/fileinfo.html

If you click the button the animation and progress bar both stop until the count has finished.
0
 
LVL 48

Expert Comment

by:jpaulino
Comment Utility
Can upload in another site ? My system polices filter is locking that site.

Can you use ee-stuff.com
0
 
LVL 1

Author Comment

by:3Si_pnewman
Comment Utility
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 48

Expert Comment

by:jpaulino
Comment Utility
You have to lunch a new thead for the cycle  not for the animation. An easy way (I use it allot)

Add a BackGroundWorker to your project then:

Private Sub BackGroundWorker1.DoWork(...) Handler backgroundoworker1.DoWork
    ' Add your cycle
   For x As Integer = 1 to 2000
      Debug.Print(x)
   Next X
End Sub

And in the button1.click event simply do
BackGroundWorker1.RunWorkerAsync()

0
 
LVL 21

Expert Comment

by:mastoo
Comment Utility
I don't have an answer offhand but would venture the problem is that the 3rd party control and your animated gifs are both running on the form and both using the message pump thread.  Does the 3rd party control have a visual component or is it just doing some functionality?
0
 
LVL 1

Author Comment

by:3Si_pnewman
Comment Utility
It is a report preview control from http://www.componentone.co.uk/StudioEnterprise/NETToolset.aspx

There is a method that populates the control with the actual document and it sometimes takes a while.  I have tried creating the controls dynamically and not adding them to the form until all the processing is completed on a separate thread (as suggested by jpaulino) but get all kinds of cross-threading errors.

Looking at the stack trace the errors are coming from the control itself not any of my code, I think I might have to contact support and see if they can suggest anything.
0
 
LVL 21

Assisted Solution

by:mastoo
mastoo earned 100 total points
Comment Utility
I hate to give an "unhelpful" answer but that might be a best first step.  I'm not aware of a practical method of keeping a responsive gui when a visual component won't yield the message pump which is what this sounds like.
0
 
LVL 1

Author Closing Comment

by:3Si_pnewman
Comment Utility
Im getting nowhere fast so I think I'll have to give support a go.

Thanks for your help.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now