Hab ich mal irgendwo gefunden! Ich glaub, dat is ab D6!
Hoffe es hilft.
Delphi-Quellcode:
uses
CheckLst;
function CheckListBoxHoriScrollBar(CLB: TCheckListBox);
var
i, nMaxWidth, nItemWidth : integer;
begin
nMaxWidth := CLB.ClientWidth;
for i := 0 to CLB.Items.Count - 1 do
begin
nItemWidth := Length(CLB.Items[i]) * 5 + 20;
if (nItemWidth > nMaxWidth) then
nMaxWidth := nItemWidth;
end;
if (nMaxWidth > CLB.ClientWidth) then
CLB.ScrollWidth := nMaxWidth;
end;