TTreeView checkbox loses "selected" state after change scale on screen

104 Views Asked by At

As in topic. When I change scale of screen, example from 100% to 125% in windows(screen setting) my TTreeView Repaints and loses checked/selected state in checkboxes.

Delphi 11 and 12 - the same behaviour. VCL

Any suggestion?

enter image description here

1

There are 1 best solutions below

0
Stepel On

I asked on another website and someone after confirmed my bug report gave me suggestion which looks like works! Of course it needs to be tested but for me it helped.

const
  CM_BASE = $B000;
  CM_RECREATEWND = CM_BASE + 51;
type
  TTreeView = class(Vcl.ComCtrls.TTreeView)
  protected
     procedure CMRecreateWnd(var Message: TMessage); message CM_RECREATEWND;
  end;

  implementation

{$R *.dfm}

procedure TTreeView.CMRecreateWnd(var Message: TMessage);
begin
  Message.Result:= 0;
end;