
How to tell when all a form and all it's elements are done loading
I thought about doing something like this, but I kinda thought of it as a
hack. What about if on some systems the images load very fast but some of
the other controls don't?
I think that what I might do is on the form load event, start a timer which
will check every few ms if everything is loaded, if everything is loaded,
then I will show the form (I will leave it's visibility off by default).
That should be pretty full proof no matter what, and I can do a splash
screen before I enable the timer.
In the timer tick event, which checks if everything is loaded, I would have
a series of nested ifs, and everytime it gets passed an if (the control IS
loaded), it will increment the splash screen load indicator bar (but it it's
already been incremented for that if(from a previous tick), then it won't
increment again).
I am still thinking about how to go about it.
Quote:
> James,
> I have not tried it, but you could handle the Loaded event?
> Are you controlling the loading of the images, or are they part of the
form.
> If you control loading them, you could simply raise an event when they are
> done loading.
> Hope this helps
> Jay
> > I have wrote a program that when it's started, it downloads an xml file,
> > parses it comparing the hashvalues in that file with some files, and if
> they
> > are different downloads the new files.
> > My problem is that when the form first starts up, it has a couple of big
> > white blocks for a split second (where picturebox controls are), they go
> > away when the images replaces them.
> > I was thinking of morphing the form into a slightly smaller size with a
> > different panel that has a progress bar that gives a vague idea of the
> > progress of the loading of the form (a splash screen). Once all the
other
> > panels are finished loading, then I can swap to one of the other panels,
> and
> > then begin program execution.
> > Anyone know how to accomplish that, or have any other ideas on how to
make
> > it look a little better when starting up. Sometimes by the time the
form
> > shows, it has already downloaded and parsed the xml file, which means it
> > comes up with the download progress bar already at full, it looks ugly
if
> > you don't know why it did that, and even if you did (IE: I have a label
of
> > the progress bar that says filename & " downloaded succesfully"), it
still
> > seems funky.
> > Any ideas?