HP van Rossen
HP van Rossen

Reputation: 41

Painting issue of panels with Styles when using DoubleBuffered=true

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'.

DoubleBuffering with styles 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.

Upvotes: 3

Views: 509

Answers (0)

Related Questions