Update The Screen
-
Does anyone know how to update the screen in C#? For instance, I have a statusbar at the bottom of my form that contains the time inside a panel, how can I force the screen to update and show the current time always? I don't have to use a timer do I? Thanks in advance. Nick Parker
-
Does anyone know how to update the screen in C#? For instance, I have a statusbar at the bottom of my form that contains the time inside a panel, how can I force the screen to update and show the current time always? I don't have to use a timer do I? Thanks in advance. Nick Parker
It appears that a timer will have to be used in that case :( If you want to draw on a Control just call
CreateGraphics()
on it, but make sure you callDispose()
on it when you are done. James Sonork ID: 100.11138 - Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971 -
It appears that a timer will have to be used in that case :( If you want to draw on a Control just call
CreateGraphics()
on it, but make sure you callDispose()
on it when you are done. James Sonork ID: 100.11138 - Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971This may sound like a stupid question but I have always wonder what kind of draw on memory is taken when a timer is constantly used. I am just thinking of times when you are possibly going though a long algorithm while constantly having a timer being used to update the time on the screen. Am I just being ridiculous here or could this be a legitimate concern? Nick Parker
-
This may sound like a stupid question but I have always wonder what kind of draw on memory is taken when a timer is constantly used. I am just thinking of times when you are possibly going though a long algorithm while constantly having a timer being used to update the time on the screen. Am I just being ridiculous here or could this be a legitimate concern? Nick Parker
You shouldn't have to worry about it, the windows timer functionality was designed so it wouldn't bog the system down by itself. If an application has events waiting for it the timer event won't fire. When the system does get to fire the time it will only send one event, not the entire backlog. If you have an excessively long task running it should be placed into a work thread so that the program doesn't appear to be locked up. In that case the main application thread is doing its own thing so it can keep up with event messages sent to it. HTH, James Sonork: Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971