Painting issue of panels with Styles when using DoubleBuffered=true

隐身守侯 提交于 2021-02-10 07:05:44

问题


This may be an embarcadero VCL problem, but using the latest Delphi (10.4.1) I came across the following problem. I am use to set DoubleBuffering to true in the FormCreate, but noted that this creates a painting issue of the panels when:

  1. the panel is located inside of a groupbox
  2. a Radiobutton is added to the panel

in below image it can be seen that once DoubleBuffering is set to true, the painting of the panels get 'messed-up'.

From left to right, Windows, Cyan Dusk and Cyan Dusk with DoubleBuffering.

My question is, do other users encounter similar issues, or am I missing something here?

Source code of this model (incl. DoubleBuffering) is quite basic:


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.

来源:https://stackoverflow.com/questions/65408970/painting-issue-of-panels-with-styles-when-using-doublebuffered-true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!