Panel Invalidate(Rectangle) Update() does not work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asfmendes
    New Member
    • Mar 2010
    • 3

    Panel Invalidate(Rectangle) Update() does not work

    Hello everyone!

    I am creating a C# application for tablet pcs and I want to animate some strokes. I am moving the strokes and, after each move, I want to reflect that move in the screen. However, if I use the refresh(), I get a lot of flickering (since the whole screen is redrawn). I only need to redraw, at each step, a certain rectangle of the panel. Thus, I am using panel.Invalidat e(rect); and panel.Update(). From what I know about this methods, I am adding the rectangle to the areas that should be redrawn in the next paint call, and then I force the redraw with the update method.
    However, nothing happens. The screen remains exactly the same.

    I want to avoid the flickering so I can't use the refresh. I can't use double-buffering since I want to show each modification and not only a final result. So can anyone point out what am I doing wrong with the invalidate+upda te or suggest another way of doing this?

    Many thanks in advance!
  • asfmendes
    New Member
    • Mar 2010
    • 3

    #2
    Any ideas? I would really appreciate some help :)

    Comment

    • GaryTexmo
      Recognized Expert Top Contributor
      • Jul 2009
      • 1501

      #3
      I'm not really an expert at GDI+ graphics, though the one thing I did do used a similar method and appeared to work... I just don't think I'm qualified to debug it :D

      However, on the topic of double buffering... you could use this, you just need to keep track of what's drawn and then redraw every frame. I have no idea what your application is though, just throwing that out there as a suggestion.

      Also, if you're running into problems of flickering, perhaps your drawing package (again, is this GDI+) isn't suitable to your needs. Have you considered using an XNA/DirectX control embedded on your form to handle drawing?

      Just some ideas :)

      Comment

      • asfmendes
        New Member
        • Mar 2010
        • 3

        #4
        Thank you very much for your reply! I don't think I understood well what you said about double buffering. I will have a more detailed look at it and see if I can use it. I'll let you know how it goes.
        Cheers!

        Comment

        Working...