I have a project that does a LOT of stuff on startup. The load time is about 22 seconds in the IDE. There's a splash screen that shows for about 12 seconds of that, then it goes away, the screen goes white for another 8 seconds, then the screen draws in the last two seconds, which is slow enough to be visible.
The slow drawing doesn't bother me too much. The form is mostly made up of an XNA-drawn panel with a bunch of XNA-drawn controls on them. Once the form is up the first time, redrawing those controls is pretty quick (quick enough to zoom in and out smoothly), so a couple seconds at startup isn't an issue, nor is the time taken while the splash screen is up, since that's what it's for. It's that white screen in the middle that I want to get rid of.
After doing a bit of profiling, I have determined that the splash screen goes away about the time that the constructor ends, and just before the Load event starts. The white screen is up during the Load event activities, which I put in the Load event because they are dependent on the size of the form, which isn't known at the time of the constructor. In fact, the whole white screen appears to be a single method call, but that's life.
What I am looking for is one of two things:
1) A way to move the code out of the Load Event to before the splash screen goes away. This would require that the splash screen be up while the size of the form is known, which may not be possible. I'm not sure when the form gets its display size, but apparently not during the constructor.
2) An alternative idea. One thing that occurs to me is to load the form but not show it. I'd have to show something, but I could come up with a dummy form to show during that interval. The actual form could possibly be loaded either behind the dummy form, or off the screen. I haven't tried any of that, yet, and figured that somebody else probably has, so I'll ask.
Any suggestions?
The slow drawing doesn't bother me too much. The form is mostly made up of an XNA-drawn panel with a bunch of XNA-drawn controls on them. Once the form is up the first time, redrawing those controls is pretty quick (quick enough to zoom in and out smoothly), so a couple seconds at startup isn't an issue, nor is the time taken while the splash screen is up, since that's what it's for. It's that white screen in the middle that I want to get rid of.
After doing a bit of profiling, I have determined that the splash screen goes away about the time that the constructor ends, and just before the Load event starts. The white screen is up during the Load event activities, which I put in the Load event because they are dependent on the size of the form, which isn't known at the time of the constructor. In fact, the whole white screen appears to be a single method call, but that's life.
What I am looking for is one of two things:
1) A way to move the code out of the Load Event to before the splash screen goes away. This would require that the splash screen be up while the size of the form is known, which may not be possible. I'm not sure when the form gets its display size, but apparently not during the constructor.
2) An alternative idea. One thing that occurs to me is to load the form but not show it. I'd have to show something, but I could come up with a dummy form to show during that interval. The actual form could possibly be loaded either behind the dummy form, or off the screen. I haven't tried any of that, yet, and figured that somebody else probably has, so I'll ask.
Any suggestions?