Re: adding a horzontail scroll bar to a list box
- From: alanglloyd@xxxxxxx
- Date: 5 Sep 2005 22:09:12 -0700
See the LB_SETHORIZONTALEXTENT windows message in Win32 help..
procedure SetListBoxHorzScroll(ListBox : TListBox);
var
i, StrWidth, MaxWidth, LBScrollWidth : integer;
begin
{get max text width}
MaxWidth := 0;
with ListBox do begin
for i := 0 to {.}Items.Count - 1 do begin
StrWidth := {.}Canvas.TextWidth({.}Items[i]);
if StrWidth > MaxWidth then
MaxWidth := StrWidth;
end; {for i := 0 to Items.Count - 1}
{calculate scroll width}
LBScrollWidth := MaxWidth + 4; // plus 4 for borders;
{set scroll width}
{.}Perform(LB_SETHORIZONTALEXTENT, LBScrollWidth, 0);
end;
end;
Alan Lloyd
.
- References:
- adding a horzontail scroll bar to a list box
- From: anthony
- adding a horzontail scroll bar to a list box
- Prev by Date: adding a horzontail scroll bar to a list box
- Next by Date: ActiveX: newbie seeks help
- Previous by thread: adding a horzontail scroll bar to a list box
- Next by thread: Re: adding a horzontail scroll bar to a list box
- Index(es):