Delphi XE2 VCL styles, weird glitch, window invisible

China☆狼群 提交于 2019-12-11 06:57:39

问题


I'm experiencing a very weird problem with VCL styles. Sometimes, when either starting the program with a predefined style, or setting one later on, one or some of the program windows dissapear.

This happens very randomly, maybe once every 10-20 times, and not in any specific window. I have 2 forms open at runtime, sometimes it's one, sometimes the other.

When this happens, I check some properties while the window is not visible, the Visible property is true, the window boundaries are correct; if I try to show the window through Aero DWM live thumbnails.. it's also empty; if I capture the window DC however, I get a bitmap with the window as if it was showing normally (and the style has been applied).

It doesn't show any errors, no warnings, no exceptions.. nothing seems wrong, just the window isn't there. If I hover the mouse over the taskbar button to see a preview, it shows the box, but it's empty.

Any ideas what to check?

Edit: calling RecreateWnd fixes the issue as a temporal workaround, however, it might fail again.


回答1:


Found the cause of the issue: "Alphablend". If this is enabled, even at 255, the issue occurs.

Steps to reproduce:

  • Open new VCL forms project
  • Project options, appearance, set a style theme. I used Cobalt XE for the test
  • Set Alphablend to true
  • Run

It may take 10-20 runs till it glitches.

I noticed when it happens, the window is actually there.. you can hover the mouse over and notice there is something there. You can even click on controls if you guess their location. If you manage to drag the window while it's not visible, it will show up. If you minimize/restore it will show up as well.

If you do alt+PrtScr while the window is active, and paste in Paint etc, you will get the contents behind it with the window boundaries, as if alphablendvalue was set to 0.



来源:https://stackoverflow.com/questions/10009842/delphi-xe2-vcl-styles-weird-glitch-window-invisible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!