Auto Repaint

I finally made my first windows app, but I have 1 problem. It runs slow because it repaints every time I set a pixel color. How do you turn off auto-repaint and how do you repaint manually?

Comments

  • : I finally made my first windows app, but I have 1 problem. It runs slow because it repaints every time I set a pixel color. How do you turn off auto-repaint and how do you repaint manually?
    :
    :
    [blue]provide some code - maybe WM_PAINT case...[/blue]
  • [b][red]This message was edited by JasonD at 2003-9-2 16:27:50[/red][/b][hr]
    To my knowledge, there is no auto repaint feature that can be turned on to begin with. You can manually repaint by processing the WM_PAINT message. If you have CS_HREDRAW | CS_VREDRAW as part of the window styles, whenever the window is resizing, the entire window is invalidated, thus sending a WM_PAINT message to repaint the entire client area. Perhaps this is what you are speaking about?
    Jason Doucette
    http://www.jasondoucette.com/
    "[italic]If you don't win, its not a great tragedy - the worst that happens is that you lose a game.[/italic]" - [italic]Bobby Fischer[/italic]

    (edit: typo)



  • I might be doing something wrong, but every time I use the SetPixel() command inside of WM_PAINT it redraws, and I use the command tons of times so you can watch the window turn black in the beginning from left to right. I would give my code for it but I'm not home now.

    -|-|-|X


  • How many pixels are you drawing? All SetPixel() does is set a pixel color; it does not invalidate the client area. You should paste your WM_PAINT handler so we can take a look, but first minimize its size as MUCH as possible. In doing so, you may find the problem yourself, and if not, it will be easier for us to look at it.
    Jason Doucette
    http://www.jasondoucette.com/
    "[italic]If you don't win, its not a great tragedy - the worst that happens is that you lose a game.[/italic]" - [italic]Bobby Fischer[/italic]

  • :
    : I might be doing something wrong, but every time I use the SetPixel() command inside of WM_PAINT it redraws, and I use the command tons of times so you can watch the window turn black in the beginning from left to right. I would give my code for it but I'm not home now.
    :
    : -|-|-|X
    :
    :
    :

    SetPixel() is very slow if you are working with a large area. There is probably a better way of doing what you want.


    Med venlig hilsen,

    Adrian...

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories