Einzelnen Beitrag anzeigen

jottkaerr

Registriert seit: 2. Jul 2007
Ort: Tuttlingen
81 Beiträge
 
Delphi 10.1 Berlin Professional
 
#5

Re: [TListView] Spalten immer so breit machen wie erforderli

  Alt 17. Nov 2008, 06:56
Aus meiner Grabbelkiste

Delphi-Quellcode:
procedure OptimizeColumns(const ListView: TListView);
var
  Column: TListColumn;
  ColumnWidthsHeader: Integer;
  ColumnWidthsText: Integer;
  i: Integer;
begin
  for i := 0 to ListView.Columns.Count - 1 do
  begin
    Column := ListView.Column[i];

    Column.Width := ColumnHeaderWidth;
    ColumnWidthsHeader := ListView_GetColumnWidth(ListView.Handle, i);

    Column.Width := ColumnTextWidth;
    ColumnWidthsText := ListView_GetColumnWidth(ListView.Handle, i);

    if ColumnWidthsHeader > ColumnWidthsText then
      Column.Width := ColumnWidthsHeader
    else
      Column.Width := ColumnWidthsText;
  end;
end;
jkr
Jürgen Krämer
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
  Mit Zitat antworten Zitat