How can I adjust the indentation of a Virtual TreeView column when auto resizing?

StackOverflow https://stackoverflow.com/questions/11576090

  •  22-06-2021
  •  | 
  •  

Question

I want to make my columns in a VirtualStringTree to have the same indentation on the left and on the right side of the content when auto sizing a column.

Take a look at my sample VST with Header Option hoDblClickResize turned on.

VST sample image

In this picture I doubleclicked the column header to auto resize the "Time" column. I highlighted the difference in indentation between the left and the right side of the column.

How can I adjust the VST so the right indent becomes the same size as the left indent? Do I have to hack the VST source code? If so, can anybody point me to the right place in the code?

Était-ce utile?

La solution

Write the OnAfterGetMaxColumnWidth event handler and increase the MaxWidth parameter there. I haven't found a property doing this.

procedure VirtualStringTreeAfterGetMaxColumnWidth(Sender: TVTHeader; 
  Column: TColumnIndex; var MaxWidth: Integer);
begin
  MaxWidth := MaxWidth + VirtualStringTree.TextMargin;
end;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top