Results 1 to 17 of 17

Thread: Cls

  1. #1

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Talking 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.

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: Cls

    So you are refreshing the pictures every millisecond, Fazi ¿
    VB.NET MVP 2008 - Present

  3. #3
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    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

  4. #4

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Cls

    Hai hanne !

    Yes, i do
    VB Code:
    1. picture1.cls
    2. picture2.cls
    3. picture3.cls

    Yes. every millisecons.
    i have no idea to explain the complexcity of the pictures. but the pictures got 3 smal graphics.

  5. #5
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: Cls

    Why do you want to do this?

  6. #6
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    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

  7. #7
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: Cls

    If you refresh the pics very millisecond .It would appear as blank anyway.So whats the point in doing so??
    __________________
    ________________0îîî___
    ___îîî0________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

  8. #8

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Talking Re: Cls

    Quote 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

  9. #9

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Talking Re: Cls

    Quote 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).

  10. #10

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Talking Re: Cls

    Quote 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....

  11. #11
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: Cls

    Quote 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

  12. #12

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Cls

    Thank you every body....

  13. #13
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    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.

  14. #14

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Cls

    Hai jacob

    Thank you for the usuful tips. i picked up 'Time Based Movment' & 'Managed Game Loo ' form you signature.

  15. #15
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: Cls

    Rather than a timer you may consider using the pictureboxes' or the form's mousemove events.

  16. #16

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Exclamation Re: Cls

    Quote 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 .

  17. #17
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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
  •  



Click Here to Expand Forum to Full Width