加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

带有Aero玻璃的Windows版本的Delphi 2010按钮将文本变为白色

发布时间:2020-12-14 03:51:39 所属栏目:Windows 来源:网络整理
导读:有一天,我开始在Delphi中使用不同的视觉效果,并使用Aero Glass效果(我安装了Delphi 2010)遇到问题:当我把按钮放在玻璃上时,这个按钮的某些部分(或者一些)其他元素)燃烧并变得透明.我不知道为什么,但我试图在其他计算机上做同样的例子.这个错误重复了. 带有b
有一天,我开始在Delphi中使用不同的视觉效果,并使用Aero Glass效果(我安装了Delphi 2010)遇到问题:当我把按钮放在玻璃上时,这个按钮的某些部分(或者一些)其他元素)燃烧并变得透明.我不知道为什么,但我试图在其他计算机上做同样的例子.这个错误重复了.

带有bug的截图;第二个按钮的标题是透明的:

我的示例程序:

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

解决方法

这是Delphi 2010中对“玻璃”(使用DWM的Aero组合)支持的已知错误,我相信它已在Delphi XE中修复,我选择使用的解决方法是使用我自己的自定义TButton类.

当我在2010年看到它时,我向Embarcadero报告了这个错误,就像其他人一样,我似乎无法找到QC#(错误报告#),但是建议的双缓冲解决方案对我来说是不可接受的.我认为TBitBtn没有表现出这个问题,这是我最简单的解决方法,尽管它有其他问题.

Delphi 2010中有很多玻璃问题.一般建议;升级Delphi.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读