Delphi XE2 VCL样式,奇怪的故障,窗口不可见 [英] Delphi XE2 VCL styles, weird glitch, window invisible

查看:89
本文介绍了Delphi XE2 VCL样式,奇怪的故障,窗口不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用VCL样式时遇到了一个非常奇怪的问题。有时,当以预定义样式启动程序或稍后设置程序时,一个或某些程序窗口会消失。

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.

这种情况非常随机发生,也许每次10-20次,并且不在任何特定窗口中。我在运行时打开了2个表单,有时是一个,有时是另一个。

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.

这种情况发生时,我检查了一些属性,但窗口不可见,Visible属性是是的,窗口边界是正确的;如果我尝试通过Aero DWM实时缩略图显示窗口,则该窗口也为空;但是,如果我捕获了窗口DC,则会得到一个与窗口一样的位图,就像它正常显示一样(并且样式已经应用)。

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.

有什么想法要检查吗?

编辑:调用RecreateWnd可以暂时解决此问题,但是,它可能再次失败。

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

推荐答案

找到了问题的原因: Alphablend。如果启用了此功能,即使在255,也会出现问题。

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

重现步骤:


  • 打开新的VCL表单项目

  • 项目选项,外观,设置样式主题。我使用Cobalt XE进行了测试

  • 将Alphablend设置为true

  • 运行

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

可能要花10到20次才能运行。

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.

如果在窗口处于活动状态时执行alt + PrtScr并粘贴在Paint等中,则将获得内容后面带有窗口边界,好像alphablendvalue设置为0。

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.

这篇关于Delphi XE2 VCL样式,奇怪的故障,窗口不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆