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

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

  •  22-06-2021
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top