Klappt aber nicht.
Die Options im Header habe ich wie folgt gesetzt:
Code: Alles auswählen
vst.Header.AutoSizeIndex:=-1;
vst.Header.AutoFitColumns(False);
vst.Header.Options := [hoAutoResize,hoColumnResize,hoDblClickResize,hoOwnerDraw,hoVisible];
vst.Header.Columns[i].Options := [coAllowClick,coEnabled,coParentBidiMode,coParentColor,coResizable,coShowDropMark,coVisible,coAutoSpring,coAllowFocus,coEditable];
Irgendwo im Netz habe ich folgenden Code gefunden, den ich nach dem vollständigen Aufbau der VST laufen lasse. Stand wohl schon jemand anderes vor dem gleichen Problem.
Code: Alles auswählen
procedure TfMain.ResizeTree(_vst: TVirtualStringTree; iStartCol: Integer);
var
c: UInt32;
ws: String;
cnv: TCanvas;
Fnt: TFont;
ThisWidth: UInt32;
MinWidth: UInt32;
Node: PVirtualNode;
r: TRect;
s: TSize;
begin
cnv := _vst.Canvas;
for c := iStartCol to _vst.Header.Columns.Count - 1 do begin
ws := _vst.Header.Columns[c].Text;
GetTextExtentPoint32W(cnv.Handle, PWideChar(ws), Length(ws), s);
MinWidth := s.cx + 10;
Fnt := _vst.Font;
Node := _vst.GetFirst;
while Assigned(Node) do begin
_vst.GetTextInfo(Node, c, Fnt, r, ws);
ThisWidth := r.Right - r.Left + 10;
if MinWidth < ThisWidth then MinWidth := ThisWidth;
Node := _vst.GetNext(Node);
end;
_vst.Header.Columns[c].Width := MinWidth;
end;
end;
Mach ich da mit den Options was falsch?
AutoFitColumns habe ich nach dem Laden der VST ausgeführt.
Habe AutoFitColumns auch schon mit vollständigen Parametern probiert:
Code: Alles auswählen
AutoFitColumns(False,smaAllColumns,1,vstLst.Header.Columns.Count-1)