lundi 2 mars 2015

Strange/Unpredictable Transparent Background Bug In Winforms Application

I've been experiencing a very strange bug with a Winforms application, where showing a hidden form may result in that form's buttons & backgrounds coming up transparent. Buttons can be subsequently revealed by moving the mouse over them, as if the form hadn't been properly invalidated/drawn. Here's a short screengrab to show what it looks like: http://ift.tt/1B4AoUT. Explicitly calling Invalidate() or Refresh() in the Show event doesn't fix it.


What's strange is that this issue appears only on SOME computers, and I haven't been able to discern anything that those computers have in common. Here's another screengrab of the same binary run on another system, where it works properly: http://ift.tt/1EHMeXU



  • I've seen it happen in different versions of Windows 7 (Embedded, x64, and x86) - but not all instances of any of those.

  • All systems are running the same version of .NET, and all have been fully updated.

  • On systems where it happens, it only happens when showing a form that'd been previously shown & hidden; it occurs when re-showing it (i.e. never the very first time the form is created & shown).

  • On systems where it happens, it doesn't happen for all forms (example: here's another that works fine, on the system exhibiting the glitch in the screengrab above: http://ift.tt/1B4AoUX).

  • On systems where it happens, it only happens if the application is scaled to the full resolution of the screen. I use this.Scale() to scale each form up to a user-specified resolution; if that's the same as the screen resolution, the bug may happen on some systems (but not all); if it's scaled up to anything less, I've never seen it happen (example: same system as shows the bug in the 1st example above doesn't with a lower scale-value: http://ift.tt/1B4Ar2Q).


I've been tearing my hair out trying to figure out what's different about the systems that exhibit the issue, and why it's happening in the first place. I literally had to have a client ship me a laptop that shows the issue, as I couldn't reproduce it on any systems I have here. Finally I've got my hands on one where it's reproducable - but I'm really at a loss as to the cause...


Aucun commentaire:

Enregistrer un commentaire