Add a horizontal scrollbar to a listbox

Diposting oleh Source Code Program | 05.53 | | 0 komentar »

procedure TForm1.Timer1Timer(Sender: TObject);

var

i,len,width: integer;

begin

with listbox1 do

begin

width := 0;

for i := 0 to items.count -1 do

begin

len := canvas.textwidth(items[i]);

if len > width then width := len;

end;

//set listbox's horizontal scrollbar width

Perform(LB_SETHORIZONTALEXTENT,width+100,0);

end;

end;

0 komentar