Moin,
versuch doch mal folgendes...
Delphi-Quellcode:
procedure ScrollBoxToCanvas(ScrollBox:TScrollBox; Canvas:TCanvas);
var saveY, Y, SchrittY:integer;
saveX, X, SchrittX:integer;
abbruchY, abbruchX:boolean;
saveBorderStyle:TBorderStyle;
begin
saveY:=ScrollBox.VertScrollBar.Position;
saveX:=ScrollBox.HorzScrollBar.Position;
saveBorderStyle:=ScrollBox.BorderStyle;
ScrollBox.BorderStyle:=bsNone;
ScrollBox.VertScrollBar.Position:=0;
Y:=0;
SchrittY:=ScrollBox.Height-20;
repeat
ScrollBox.HorzScrollBar.Position:=0;
X:=0;
SchrittX:=ScrollBox.Width-20;
abbruchY:=(ScrollBox.VertScrollBar.Position <> Y);
repeat
abbruchX:=(ScrollBox.HorzScrollBar.Position <> X);
ScrollBox.Refresh;
ScrollBox.PaintTo(
Canvas,
ScrollBox.HorzScrollBar.Position,
ScrollBox.VertScrollBar.Position
);
ScrollBox.HorzScrollBar.Position:=ScrollBox.HorzScrollBar.Position + SchrittX;
X:=X+SchrittX;
until abbruchX;
ScrollBox.VertScrollBar.Position:=ScrollBox.VertScrollBar.Position + SchrittY;
Y:=Y+SchrittY;
until abbruchY;
ScrollBox.VertScrollBar.Position:=saveY;
ScrollBox.HorzScrollBar.Position:=saveX;
ScrollBox.BorderStyle:=saveBorderStyle;
end;
...nicht schön, aber selten!
MfG
Thorsten