为ListBox添加水平滚动条

//为ListBox添加水平滚动条
procedure TfrmLNKCCLBD.ShowHorScroll;
var
  i, MaxWidth: integer;
begin
  MaxWidth :=   0;
  for i:=0 to lbxFFLB.Items.Count-1 do
  if MaxWidth<lbxFFLB.Canvas.TextWidth(lbxFFLB.Items.Strings[i]) then
     MaxWidth := lbxFFLB.Canvas.TextWidth(lbxFFLB.Items.Strings[i]);
  SendMessage(lbxFFLB.Handle,LB_SETHORIZONTALEXTENT, MaxWidth+5,0);
end;

你可能感兴趣的:(职场,Delphi,listbox,休闲,水平滚动条)