带有Aero效应的Delphi XE会导致油漆问题 [英] Delphi XE with Aero effects causes paint issue

查看:200
本文介绍了带有Aero效应的Delphi XE会导致油漆问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从2009年升级到Delphi XE,遇到了一个奇怪的问题。

I have upgraded to Delphi XE from 2009 and am experiencing a strange issue.

我创建一个新项目,放下一个TRibbon控件,编译并运行。将表单保留在默认大小中,然后将其最小化并恢复,而不会出现问题。然后我最大化形式,最小化和恢复,并将表单颜色更改为黑色。

I create a new project, put down a TRibbon control, compile and run. Keeping the form in its default size I then minimize and restore without issues. I then maximise the form, minimize and restore and the form colour is changed to black.

我没有随机代码来更改它,并且正在使用Delphi XE自带的所有默认值,它每次都会失败。

I have no random code to change it and am using all defaults Delphi XE comes with and it does it each and every time without fail.

我已将编译的exe移动到朋友的电脑,问题依然存在,所以我知道这不是我的电脑。如果我关闭Aero效果,问题就会消失,但是将Aero重新打开,问题就会返回。

I have moved the compiled exe to a friends computer and the problem remains so I know it's not my computer. If I turn off Aero effects the problem goes away, but put Aero back on and the problem returns.

有什么想法吗?我无法在跨网路上找到有关此问题的任何相关内容。

Any ideas at all? I'm having trouble finding any relevant threads regarding this issue across the interwebs.

谢谢,
Seb

Thanks, Seb

编辑(根据请求,显示此行为的表单的DFM)注意:这种情况发生在我开始的任何项目中):

Edit (as requested, the DFM for the Form that displays this behaviour. Note: This happens on any project I start):

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 555
  ClientWidth = 989
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  PrintScale = poNone
  Scaled = False
  PixelsPerInch = 96
  TextHeight = 13
  object Ribbon1: TRibbon
    Left = 0
    Top = 0
    Width = 989
    Height = 143
    Caption = 'Ribbon1'
    ExplicitLeft = 104
    ExplicitTop = 296
    ExplicitWidth = 0
    StyleName = 'Ribbon - Luna'
  end
end

这只是一个单一形式的新项目。

Nothing fanciful at all, it's just a new project with a single form.

推荐答案

我可以重现错误,这里有一些问题发现。也许他们会帮助某人弄清楚这件事情。

I am able to reproduce the bug, here are some of the issues I discovered. Maybe they'll help someone figure this thing out.


  • 如果我在表单上放置一个按钮,并调用无效从按钮的 OnClick 事件中,表单得到它的颜色。

  • 如果我放置一个地方计时器在 WndProc WM_SIZE wParam = SIZE_MAXIMIZED ,然后从定时器中调用无效,该表单将返回颜色。这与第一种方法基本相同(从按钮调用 Invalidate ),但定时器使此自动生效,并确保无效。我尝试一个简单的 PostMessage 但没有工作(即:我可能是无效 - 太早了,这可能是另一个线索)

  • 有趣的:如果我使 Application.MainFormOnTaskbar:= False 在项目的来源中,我不再看到黑色的形式。

  • If I place a button on the form and call Invalidate from the button's OnClick event, the form gets it's colors back.
  • If I place a place a timer on the form, enable the timer from WndProc on WM_SIZE with wParam = SIZE_MAXIMIZED, then call Invalidate from the timer the form gets it's colors back. This is essentially the same as the first method (calling Invalidate from a button), but the timer makes this automatic and ensures Invalidate is called only when there are no more messages to be processed. I tried the same with a simple PostMessage but didn't work (ie: I was probably Invalidate-ing too soon, and that's probably an other clue)
  • Interesting: If I make Application.MainFormOnTaskbar := False in the project's source, I no longer see the black form.

功能区占用表单的顶部。在表单的其余部分放置一个 TPanel ,使其 Align = alClient 并将所有内容都放在Panel上。面板后面的黑色不再可见!

The ribbon takes up the top part of the form. Place a TPanel on the rest of the form, make it Align = alClient and put everything on the Panel. The Black behind the panel is no longer visible!

这篇关于带有Aero效应的Delphi XE会导致油漆问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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