...in einer Listbox einen horizontalen Scrollbalken anzeigen?
Autor: Thomas Stutz
procedure HorScrollBar(ListBox: TListBox; MaxWidth: Integer);
var
i, w: Integer;
begin
if MaxWidth = 0 then
SendMessage(ListBox.Handle, LB_SETHORIZONTALEXTENT, MaxWidth, 0)
else
begin
{ get largest item }
for i := 0 to ListBox.Items.Count - 1 do
with ListBox do
begin
w := Canvas.TextWidth(Items[i]);
if w > MaxWidth then
MaxWidth := w;
end;
SendMessage(ListBox.Handle, LB_SETHORIZONTALEXTENT,
MaxWidth + GetSystemMetrics(SM_CXFRAME), 0);
end;
end;
printed from
www.swissdelphicenter.ch
developers knowledge base