Tech Off Post

Single Post Permalink

View Thread: Form.Text does not update
  • ploe

    W3bbo said:
    ploe said:
    *snip*

    Can you post your code?

    I'm an idiot. I couldn't find the bug because it wasn't in the window's code, but our base class that it extends. The other windows where the title update does work inherits a different base class.

     

    In our base class we disabled painting while the window was in a state of populating data (because we were getting flicker) with this line:

    SendMessage(this.Handle, WM_SETREDRAW, 0, IntPtr.Zero);

     

    We re-enabled painting when it is done populating with this line:

    SendMessage(this.Handle, WM_SETREDRAW, 1, IntPtr.Zero);

     

    Then we call Invalidate(true). But that just invalidates the client area, not the non-client area, hence why the title bar was not re-painting.

     

    Solution:

    Invalidate and paint the ENTIRE window by calling: InvalidateRect() and then UpdateWindow().

     

    Sorry for the wild goose chase.