|
Thread: Cls
-
Nov 6th, 2006, 09:10 AM
#1
Cls
Hai
I have 3 picture controls in a form
i have used a timer with interval set to 1 to CLS those images.
Will this constant cls (refresh) make any perforamnce Problems?
But in my pc (2600+ sampron) process and memory are nomal. no problem at all.
-
Nov 6th, 2006, 09:16 AM
#2
Re: Cls
So you are refreshing the pictures every millisecond, Fazi ¿
VB.NET MVP 2008 - Present
-
Nov 6th, 2006, 09:18 AM
#3
Re: Cls
If that's the case I'd say it will depend on the whole complexity of the pictures you are clearing, if it's going to cause perfomance issues.
VB.NET MVP 2008 - Present
-
Nov 6th, 2006, 09:24 AM
#4
Re: Cls
Hai hanne !
Yes, i do
VB Code:
picture1.cls
picture2.cls
picture3.cls
Yes. every millisecons.
i have no idea to explain the complexcity of the pictures. but the pictures got 3 smal graphics.
-
Nov 6th, 2006, 09:30 AM
#5
Frenzied Member
Re: Cls
Why do you want to do this?
-
Nov 6th, 2006, 09:30 AM
#6
Re: Cls
OK, if the the pictureboxes contain only small graphics, it shouldn't be something to worry about (IMHO).
What I'd suggest you do is to test this particular issue.
Run the program, and let the Timer clear those boxes (the whole time ) - so basically keep the program running for (let's say) a minute, even 2 minutes. If you haven't seen a loss in performance, you should be fine. If you see that the clearing of the pictures become a bit slower, or even the program "works" slower, you'll have a problem
At least, that's what I would do
VB.NET MVP 2008 - Present
-
Nov 6th, 2006, 09:39 AM
#7
Re: Cls
If you refresh the pics very millisecond .It would appear as blank anyway.So whats the point in doing so??
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Nov 6th, 2006, 11:13 AM
#8
Re: Cls
 Originally Posted by jeroen79
Why do you want to do this?
Hai jeroen
the pictures need to react to every mouse move event i.e. pixel by pixel
Thats y
-
Nov 6th, 2006, 11:17 AM
#9
Re: Cls
 Originally Posted by litlewiki
If you refresh the pics very millisecond .It would appear as blank anyway.So whats the point in doing so??
Please check my last post (before this one) Litlewiki.
No. the pictures are fine. but if i increase the interval it is over painted by another graphic (the background graphic which is one of 3 pictures).
-
Nov 6th, 2006, 11:33 AM
#10
Re: Cls
 Originally Posted by HanneSThEGreaT
OK, if the the pictureboxes contain only small graphics, it shouldn't be something to worry about (IMHO).
What I'd suggest you do is to test this particular issue.
Run the program, and let the Timer clear those boxes (the whole time ) - so basically keep the program running for (let's say) a minute, even 2 minutes. If you haven't seen a loss in performance, you should be fine. If you see that the clearing of the pictures become a bit slower, or even the program "works" slower, you'll have a problem
At least, that's what I would do 
Hai Hanne...
Thank you for your effort to solve my issue.
The main thing considering the interval is the pictures need to react to every mouse move event i.e. pixel by pixel. so it need to be constantly clear on each move
But i check with my AMD smpron 2600+ and in a PIII 866. Process and memory consumption is at very low. i mean no cpu usage is for the program. no problem it seems
May i continue....
-
Nov 6th, 2006, 12:19 PM
#11
Re: Cls
 Originally Posted by Fazi
May i continue....
Yes, seeing the fact that you've tested it on different pcs, and are happy with the results, continue 
Good luck with the rest of your project
VB.NET MVP 2008 - Present
-
Nov 6th, 2006, 12:24 PM
#12
-
Nov 6th, 2006, 12:33 PM
#13
Re: Cls
The Cls function unfortunately is very slow, but then again, so are timers. Timers are not only slow, but are also inaccurate, inconsistant, and get worse the more timers you run; mainly cause every one of those timers must fire off one at a time before the next one can fire. A solution to this would be to use a managed Do Loop or While Wend loop locked at a certain refresh rate, like 60 frames per second. I have the code to do this in my signature.
When it comes to games and graphics, you shouldn't have to worry about cpu usage at all. Any commercial game will be using 100% of the CPU.
-
Nov 6th, 2006, 01:25 PM
#14
Re: Cls
Hai jacob
Thank you for the usuful tips. i picked up 'Time Based Movment' & 'Managed Game Loo ' form you signature.
-
Nov 6th, 2006, 01:58 PM
#15
Frenzied Member
Re: Cls
Rather than a timer you may consider using the pictureboxes' or the form's mousemove events.
-
Nov 6th, 2006, 02:29 PM
#16
Re: Cls
 Originally Posted by jeroen79
Rather than a timer you may consider using the pictureboxes' or the form's mousemove events.
Hai jeroen
i have to track the screen mouse move events . not form mouse move .
-
Nov 7th, 2006, 04:12 PM
#17
Re: Cls
My question is: Do you have to clear the picture boxes ?
Because first of all, it flickers a lot when you do that. (at least from my experience)
In situations like this, I usually just draw on top of it, and override the previous picture/drawing...
If you have some lines (background mostly blank), instead of cls, you could draw again exactly the same lines (or whatever), but change the color to be the same as the picture's background, this will erase the drawing, and make it look like it's cleared, except it's faster, and without the flickering.
If you are thinking that drawing exactly on top is slower because you have to re-calculate the positions, well, when you calculate the first time (when drawing the lines) you can put the positions into an array, and when you want to clear it, you can get the values that you have stored, and draw again with backgound color
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|