During writing a custom control, while trying to implement the default BorderWidth
property correctly, I seem to have stumbled upon a bug in the painting behaviour when scroll bars are shown: the spaces between the scroll bars and the control's extent are not painted.
To reproduce the bug, implement the following OnCreate
handler for the main form of a new project:
procedure TForm1.FormCreate(Sender: TObject);
begin
AutoScroll := True;
BorderWidth := 20;
SetBounds(10, 10, 200, 200);
with TGroupBox.Create(Self) do
begin
SetBounds(300, 300, 50, 50);
Parent := Self;
end;
end;
The results for D7 and XE2:
It seems that this is fixed at last in Delphi XE2. Likely, this bug would reside in TWinControl.WMNCPaint
, but looking at Controls.pas
, I cannot find any significant differences in the implementation between D7 and XE2.
I would like to get answers on:
- How to write a bugfix for this oddity,
- From which Delphi version this bug seems to be fixed.