Einzelnen Beitrag anzeigen

Benutzerbild von The-X
The-X

Registriert seit: 30. Aug 2003
Ort: Woffelsbach / user.exe ;)
377 Beiträge
 
Delphi 7 Personal
 
#2

Re: ListBox mit Scrollbalken (Horizontal)

  Alt 4. Aug 2005, 00:27
Hat die ListBox nicht sogar ne Property Namens ScrollWidth?
Delphi-Quellcode:
procedure SetScrollWidth(ListBox: TListBox);
var
  DC: HDC;
  Size: TSize;
  w, i, offset: Integer;
begin
  offset := 2 * GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXVSCROLL);
  with ListBox do
  begin
    DC := GetDC(Handle);
    try
      SelectObject(DC, Font.Handle);
      w := 0;
      for i := 0 to Items.Count - 1 do
      begin
        if GetTextExtentPoint32(DC, PChar(Items[i]),
          StrLen(PChar(Items[i])), Size) then
          if w < Size.cx + offset then
            w := Size.cx + offset;
      end;
      ScrollWidth := w;
    finally
      ReleaseDC(Handle, DC);
    end;
  end;
end;
mal irgendwo durch Zufall gefunden (wenn nicht sogar hier)
WGET ftp://root@fbi.us.gov/secret/worldreign.exe <- damit werde ich die Weltherrschaft an mich reissen!
=> irc://irc.quakenet.eu.org:6667/delphi.de da werden Sie auch (manchmal) geholfen
  Mit Zitat antworten Zitat