UI updates not happening in the expected order

Posted by allonym on Stack Overflow See other posts from Stack Overflow or by allonym
Published on 2010-05-30T19:19:39Z Indexed on 2010/05/30 19:22 UTC
Read the original article Hit count: 133

Filed under:
|
|

I have a Panel which hosts a number of child controls in a grid layout. The child controls each consist of a Panel with a PictureBox and a Label. When one of these child controls is clicked it becomes "selected" (which basically entails changing its background to a different color) and an event is fired. In the handler for this event, an image is displayed in a PictureBox on a separate form.

In code, the background of the child control is definitely changed before firing the event, but for some reason it never updates at runtime until after the image has updated in the other Form. I've tried to Invalidate() and Refresh() the child control before firing the event, without effect.

Why is this happening, and what can I do to set it right?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET