The scrollbar invalidates indeed the whole region, even if it is located outside the customcontrol (and thus invisible). If nobody else has another idea I would suggest to create a bug report.
In the mean time, a workaround is to parent the scrollbox to the parent of TPaintTest. The constructor becomes then constructor TPaintTest.Create(AOwner: Tcomponent; ParentControl: TWinControl); begin inherited Create(AOwner); self.Parent:=ParentControl; self.width := 500; self.height := 500; ScrollBar:= TScrollBar.Create(Self); ScrollBar.Kind := sbVertical; ScrollBar.left:=self.width+self.left; ScrollBar.height :=self.height+self.top; ScrollBar.LargeChange := 100; ScrollBar.Max := 1000; ScrollBar.Parent := ParentControl; t := TTimer.create(self); t.interval := 1000; t.onTimer := @invalidateTest; t.enabled := true; end; Create it as t:=TPaintTest.Create(self,panel1); Downside is that you have to create the code to move/resize the scrollbar when TPaintTest moves or resizes. Ludo -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
