4
votes

The other day, I started to play with different visual effects in Delphi, and ran into a problem using Aero Glass effect (I have a Delphi 2010 installed): when I put the button on the glass, some part of this button (or some other element) burns and becomes transparent. I don't know why, but I tried to do the same example on the other computers. And this bug repeated.

Screenshot with a bug; the second button's caption is transparent: enter image description here

My example program:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.
object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 202
  ClientWidth = 331
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  GlassFrame.Enabled = True
  GlassFrame.Bottom = 50
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 64
    Top = 153
    Width = 175
    Height = 41
    Caption = 'Button1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMenuHighlight
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 0
  end
  object Button2: TButton
    Left = 64
    Top = 73
    Width = 175
    Height = 41
    Caption = 'Button1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMenuHighlight
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 1
  end
end
1
Just to clarify: Aero is a Windows thing, not a Delphi thing.Andreas Rejbrand
Your code would appear to contain a bug. Please add the code to the question. A small, complete compilable program please.David Heffernan
FYI: Aero glass will only work on Windows 7, AFAIK. As Andreas points out, this is part of Windows, so don't expect this to work on all versions of Windows.Jerry Dodge
Of course it won't work on all versions of Windows, @Jerry, but I think it's reasonable to at least expect it to work on versions that support Aero. The appearance of the form in the question suggests it's running on such a version. The question is why the button doesn't look right.Rob Kennedy
I can confirm the same behavior from .NET, so this will be the system wide problem. It's not easy to draw even plain text on aero sheet of glass (even with GDI+).TLama

1 Answers

4
votes

This is a known bug in Delphi 2010 support for "glass" (Aero Composition using DWM), I believe it was fixed in Delphi XE, and the workaround that I chose to use is to use my own custom TButton-like class.

I reported this bug to Embarcadero when I saw it in 2010, as did others, I can't seem to find the QC# (bug report #), but the suggested workaround with double-buffered is not acceptable to me. TBitBtn did not exhibit this problem I believe and was my simplest workaround, although it had other issues.

There are a lot of glass issues in Delphi 2010. General advice; Upgrade Delphi.