Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Tracing Invalidate calls (Windows Forms)

Tracing Invalidate calls (Windows Forms)

Scheduled Pinned Locked Moved C#
questionwinformsperformancehelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jon Hulatt
    wrote on last edited by
    #1

    I'm trying to do some performance enhancements to my project, and, I've discovered that frequently my animation (custom) control is getting painted twice for each distinct frame. I've traced all calls that I make to Invalidate(), but it seems that something else must be invalidating my control - for every Invalidate call that I make, there are always two calls to OnPaint. Problem is, Control.Invalidate is not marked virtual, so I cannot trap all calls to base Invalidates, which I suspect is what is causing the seemingly unneccessary Invalidates. Anyone know of a diagnostic technique that will allow me to establish why my control gets painted, for each call?

    using System.Beer;

    F L 2 Replies Last reply
    0
    • J Jon Hulatt

      I'm trying to do some performance enhancements to my project, and, I've discovered that frequently my animation (custom) control is getting painted twice for each distinct frame. I've traced all calls that I make to Invalidate(), but it seems that something else must be invalidating my control - for every Invalidate call that I make, there are always two calls to OnPaint. Problem is, Control.Invalidate is not marked virtual, so I cannot trap all calls to base Invalidates, which I suspect is what is causing the seemingly unneccessary Invalidates. Anyone know of a diagnostic technique that will allow me to establish why my control gets painted, for each call?

      using System.Beer;

      F Offline
      F Offline
      Frank Horn
      wrote on last edited by
      #2

      Can't you trap the calls from the overriden OnPaint() method? Or by overriding OnInvalidated()?

      1 Reply Last reply
      0
      • J Jon Hulatt

        I'm trying to do some performance enhancements to my project, and, I've discovered that frequently my animation (custom) control is getting painted twice for each distinct frame. I've traced all calls that I make to Invalidate(), but it seems that something else must be invalidating my control - for every Invalidate call that I make, there are always two calls to OnPaint. Problem is, Control.Invalidate is not marked virtual, so I cannot trap all calls to base Invalidates, which I suspect is what is causing the seemingly unneccessary Invalidates. Anyone know of a diagnostic technique that will allow me to establish why my control gets painted, for each call?

        using System.Beer;

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        OnInvalidate()

        xacc.ide - now with TabsToSpaces support
        IronScheme - 1.0 alpha 4a out now (29 May 2008)

        J 1 Reply Last reply
        0
        • L leppie

          OnInvalidate()

          xacc.ide - now with TabsToSpaces support
          IronScheme - 1.0 alpha 4a out now (29 May 2008)

          J Offline
          J Offline
          Jon Hulatt
          wrote on last edited by
          #4

          Thanks both, I'd not seen that event before. This has shed a bit more light on the matter: my control is only getting invalidated once. However, OnPaint is called twice - any idea why?

          using System.Beer;

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups