procedure TFrm_main.ScrollBox_datainputResize(Sender: TObject);
var
I_temp,I_control:integer;
begin
(sender as Tscrollbox).VertScrollBar.Position :=0;
I_temp:=((sender as Tscrollbox).Height -
(sender as Tscrollbox).ControlCount*(sender as Tscrollbox).Controls[0].Height)
div ((sender as Tscrollbox).ControlCount+1);
if I_temp<5 then I_temp:=5;
for I_control:=0 to (sender as Tscrollbox).controlcount-1 do
begin
with (sender as Tscrollbox).controls[I_control] do
begin
Left :=0;
Width :=(sender as Tscrollbox).width;
height:=(sender as Tscrollbox).Controls[0].Height;
Top :=I_control*(sender as Tscrollbox).Controls[0].Height + (I_control+1)*I_temp;
end;
end;
end;
初学,好多都看不懂啊,救命!!!
var
I_temp,I_control:integer;
begin
(sender as Tscrollbox).VertScrollBar.Position :=0;
I_temp:=((sender as Tscrollbox).Height -
(sender as Tscrollbox).ControlCount*(sender as Tscrollbox).Controls[0].Height)
div ((sender as Tscrollbox).ControlCount+1);
if I_temp<5 then I_temp:=5;
for I_control:=0 to (sender as Tscrollbox).controlcount-1 do
begin
with (sender as Tscrollbox).controls[I_control] do
begin
Left :=0;
Width :=(sender as Tscrollbox).width;
height:=(sender as Tscrollbox).Controls[0].Height;
Top :=I_control*(sender as Tscrollbox).Controls[0].Height + (I_control+1)*I_temp;
end;
end;
end;
初学,好多都看不懂啊,救命!!!
这么说既不科学也不好理解,还是等高手来给你解释好了 ^Q^
1 了解Sender这个冬冬
2 了解as的用法。。