使用 DoubleBuffered=true 时带有样式的面板的绘制问题

问题描述

这可能是 embarcadero VCL 问题,但使用最新的 Delphi (10.4.1) 我遇到了以下问题。 我习惯于在 FormCreate 中将 DoubleBuffering 设置为 true,但注意到这会在以下情况下产生面板的绘制问题:

  1. 面板位于分组框内
  2. 一个单选按钮被添加到面板

在下图中可以看出,一旦 DoubleBuffering 设置为 true,面板的绘制就会变得“混乱”。

DoubleBuffering with styles

从左到右,Windows、Cyan Dusk 和 Cyan Dusk with DoubleBuffering。

我的问题是,其他用户是否遇到过类似的问题,或者我在这里遗漏了什么?

该模型的源代码包括 DoubleBuffering)非常基础:


unit Test_GB_Main;

interface

uses
  Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System.Classes,Vcl.Graphics,Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    RadioButton1: TradioButton;
    RadioButton2: TradioButton;
    RadioButton3: TradioButton;
    RadioButton4: TradioButton;
    RadioButton5: TradioButton;
    RadioButton7: TradioButton;
    RadioButton8: TradioButton;

    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin
  DoubleBuffered := True ;   // to avoid flickering
end;


end.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)