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;
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;
0 comments :
Posting Komentar
Terima kasih atas kunjungan dan komentarnya