[2008] Forms, Message Boxes, Dialogs, Images loading slowly..
A while ago, I made a post about my Message Boxes loading slowly (you hear the sound, and then 1/2 second later you see the Message Box)
But this has started to happen with all my things..
My forms a little, but when I try and load an image from my resource file (My.Resources), I see it flash from the background color, to the image, for maybe 1/10th of a second... which is horrible, I have gotten around it by using a timer to delay showing it, but I still would like everything to be running better..
Nothing is wrong with my .NET framework...
So it has to be my application, (I have tested a 'test' application, which doesn't show the problems...)
I have a few timers (5),
1 runs every 10 ms,
1 runs every 10 seconds,
2 run every 1 second, and
1 runs every 500 ms until a condition is met (which is always the first run pretty much, so it turns itself off)
I have a LOT of images in my resource file, about 30-40, up to about 1.1 Megabytes worth... I also have some gradients on each of my forms...
That's all I can think of right now that might cause this kind of problem..
I will post more if I can think of them..
Does anyone know or have experience with this problem?
Cheers
Re: [2008] Forms, Message Boxes, Dialogs, Images loading slowly..
The fact that you have so many timers ticking at very small intervals (10 ms, 500 ms and 1 seconds) is telling me that your computer is so busy spending most of its processing time to keep up with all the various timer.tick events...
There's really not much you can do unless you run your app on a super-fast multi-core system OR increase the intervals of your timers, especially the one that is set at 10 ms.
Re: [2008] Forms, Message Boxes, Dialogs, Images loading slowly..
Yeah, those timers are killing you. How much processing is happening in those fast timers? If it is anything more than trivial, you could have timer events overlapping timer events. What's happening in the very fast timer? It can't be a UI thing, since the human eye couldn't track changes that fast. I'm wondering whether it could be split off into a background thread where the timer events wouldn't interfere with the UI painting.
Re: [2008] Forms, Message Boxes, Dialogs, Images loading slowly..
I'll tell you what they are for..
10 ms timer, checks if a file exists, if not, writes it,
it accesses the registry twice, and checks for a value, if it doesn't find it, it creates the value,
It also checks if a process is running.. and if not it will start it up...
but in the debug stages the process is always running...
1 second timer, is used for checking the activity of the mouse & keyboard, so I can tell when the computer has gone inactive, and then come back...
The other 1 second timer is for showing a slide show of images made by the user...
The 10 second timer does not do that much.. and is rather slow..
and my 500ms timer will stop running after about 1 second lol.. so it's nothing
I am not sure which timers I can cut back on? perhaps the 10 ms, to 100 ms..
And how would I go about putting any of these in a background thread?
I think I could put the 10ms timer, and the inactivity timer, into a background thread, they only need to access other timers / variables / background images...
Cheers
Re: [2008] Forms, Message Boxes, Dialogs, Images loading slowly..
The fast timer would be ripe for moving to a background thread, but consider what I posted in the other thread first. Basically, I question why you have that timer going that fast in the first place.