Add Scrollbar in Listbox

HOW TO ADD SCROLLBAR IN LISTBOX
In the default condition, ListBox not have horizontal scrollbar.
If you want to add horizontal scrollbar in a ListBox component,
can use the following procedure

procedure SetHorizontalScrollBar(lb : TListBox) ;
var
j, MaxWidth: integer;
begin
MaxWidth := 0;
for j := 0 to lb.Items.Count - 1 do
if MaxWidth < lb.Canvas.TextWidth(lb.Items[j]) then
MaxWidth := lb.Canvas.TextWidth(lb.Items[j]) ;

SendMessage(lb.Handle,
LB_SETHORIZONTALEXTENT,
MaxWidth + 5, 0) ;
end;


See ListBox

Postingan populer dari blog ini

vb6 msflexgrid

Tutorial Visual Basic 6.0 : Listbox in VB6

Select Single Cell in MSHFlexgrid