Sorry for my English. I'm not use English as my Primary language.
I had a problem with scrollbox with my developing program.
So I done a test by create new project.
drop a scrollbox, a panel and a button
{ TForm1 }
const
max = 100;
var
i,Atop, Awidth, Aheight: integer;
pn : array[0..max] of tImage;
procedure TForm1.FormCreate(Sender: TObject);
begin
scrollbox1.Align := alClient;
scrollbox1.VertScrollBar.Increment := 200;
for i := 0 to max do begin
pn[i] := tImage.create(scrollbox1);
pn[i].Center := True;
pn[i].AutoSize := False;
pn[i].Parent := Scrollbox1;
end;
end;
procedure TForm1.ScrollBox1Paint(Sender: TObject);
begin
panel1.Caption := inttostr(scrollbox1.VertScrollBar.Position);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
button1.Enabled := False;
Atop := 0; Awidth := scrollbox1.ClientWidth; Aheight := 1100;
for i := 0 to max do begin
// pn[i].SetBounds(0,Atop,Awidth,Aheight);
pn[i].Top := Atop;
pn[i].Left := 0;
pn[i].Width := Awidth;
pn[i].Height := Aheight;
if i = 0 then pn[i].Picture.LoadFromFile('testPic.jpg')
else pn[i].Picture := pn[i-1].Picture;
inc(Atop,Aheight+10);
end;
end;
end.
When I scroll with mouse wheel pass the position of 65535.
scrollbox position will jump back to 0.
'testpic.jpg' size is 750x1100.
I don't know that I miss/mess somethings/ or is this scrollbox limit or bug?
and Please suggest me how to avoid this.
Thanks.