procedure TUpLoadFrm.SetHorizon;
var
i,MaxWidth,j:integer;
begin
MaxWidth:=0;
for i:=0 to ListBox1.Items.Count-1 do
begin
j:=ListBox1.Canvas.TextWidth(ListBox1.Items.Strings);
if MaxWidth<j then
MaxWidth:=j;
end;
if MaxWidth>ListBox1.Width then
SendMessage(ListBox1.Handle,LB_SETHORIZONTALEXTENT,MaxWidth+5,0)
else
SendMessage(ListBox1.Handle,LB_SETHORIZONTALEXTENT,MaxWidth,0);
ListBox1.Invalidate;
end;
//首先取得最长的那一行,然后设置滚动条的长度