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. How to force dialog redraw when it regains focus?

How to force dialog redraw when it regains focus?

Scheduled Pinned Locked Moved C#
questionhelptutorialannouncementcareer
3 Posts 2 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
    JHR1
    wrote on last edited by
    #1

    Hi all, I have a large processing job that is taking an hour or two. I have a simple form that contains a statusbar panel that informs the user with progress. At the moment the update is a text string but I might move to a progress bar in the future. However, the main question is this: If I click elsewhere (outside the program) and then return focus to the form, the statusbar text does not redraw and update. It ends up stuck on wherever it was when I left it. Furthermore, it even does this if I simply move the form slightly without losing focus. Can someone advice what to do to maintain the updates? TIA Jerry

    P 1 Reply Last reply
    0
    • J JHR1

      Hi all, I have a large processing job that is taking an hour or two. I have a simple form that contains a statusbar panel that informs the user with progress. At the moment the update is a text string but I might move to a progress bar in the future. However, the main question is this: If I click elsewhere (outside the program) and then return focus to the form, the statusbar text does not redraw and update. It ends up stuck on wherever it was when I left it. Furthermore, it even does this if I simply move the form slightly without losing focus. Can someone advice what to do to maintain the updates? TIA Jerry

      P Offline
      P Offline
      predakanga
      wrote on last edited by
      #2

      Are you doing your processing in the same thread as the GUI runs in? It sounds like it. If so, you have two options - you can either break out your processing to another thread, or you can simply make sure you call Application.DoEvents() regularly. Hope that helps

      J 1 Reply Last reply
      0
      • P predakanga

        Are you doing your processing in the same thread as the GUI runs in? It sounds like it. If so, you have two options - you can either break out your processing to another thread, or you can simply make sure you call Application.DoEvents() regularly. Hope that helps

        J Offline
        J Offline
        JHR1
        wrote on last edited by
        #3

        Application.DoEvents() fixed it! Thanks!!

        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