Ian Branch 127 Posted May 1, 2023 Hi Team, I have a TListview that currently looks like this. I have tried to set the first column to Center justify but it keeps reverting to Left Justify. 😞 What I would like is for the first column to be center justified, and the second colmn's header to be center but the rest of column to be right. I would also like the Header font to be Bold as well, but there doesn't appear to be any 'Font' related property. 😞 Is this doable? If so, how please?  Regards & TIA, Ian Share this post Link to post
KodeZwerg 54 Posted May 1, 2023 Just create first column without caption and set its width to 0. The others do what you want to do. Share this post Link to post
programmerdelphi2k 237 Posted May 1, 2023 (edited) procedure TForm1.Button1Click(Sender: TObject); var MyListColumn: TListColumn; MyListItem : TListItem; begin ListView1.Columns.Clear; ListView1.ViewStyle := TViewStyle.vsReport; // MyListColumn := ListView1.Columns.Add; // 0 MyListColumn.Width := 150; MyListColumn.Alignment := TAlignment.taLeftJustify; // alignment of the leftmost column is always LVCFMT_LEFT MyListColumn.Caption := 'LeftJustify'; MyListColumn.Width := 0; // a "hack" // MyListColumn := ListView1.Columns.Add; // 1 MyListColumn.Width := 150; MyListColumn.Alignment := TAlignment.taCenter; MyListColumn.Caption := 'CenterJustify'; // MyListColumn := ListView1.Columns.Add; // 2 MyListColumn.Width := 150; MyListColumn.Alignment := TAlignment.taRightJustify; MyListColumn.Caption := 'RightJustify'; // MyListColumn := ListView1.Columns.Add; // 3 MyListColumn.Width := 150; MyListColumn.Alignment := TAlignment.taCenter; MyListColumn.Caption := 'CenterJustify'; // // 4 columns: 0, 1, 2, 3: MyListItem := ListView1.Items.Add; MyListItem.Caption := 'Item1'; // Column 0 MyListItem.SubItems.Text := 'SubItem1'; // Column 1 MyListItem.SubItems.Add('SubItem1.1'); // Column 2 MyListItem.SubItems.Add('SubItem1.1.1'); // Column 3 end; Â Edited May 2, 2023 by programmerdelphi2k Share this post Link to post
Ian Branch 127 Posted May 2, 2023 Hi p2k. Unfortunate. It offends my OCD. 😉  Ian Share this post Link to post
programmerdelphi2k 237 Posted May 2, 2023 https://learn.microsoft.com/en-US/windows/win32/api/commctrl/ns-commctrl-lvcolumna?redirectedfrom=MSDN Â Alignment of the column header and the subitem text in the column. The alignment of the leftmost column is always LVCFMT_LEFT; it cannot be changed. This member can be a combination of the following values. Note that not all combinations are valid. Share this post Link to post
KodeZwerg 54 Posted May 2, 2023 7 hours ago, programmerdelphi2k said: Your "hack" All of that is not needed, just do it in the Object Inspector like I told. Share this post Link to post