TAdvStringGrid: Text alignment in cell


I want to align the text in the first line vertical = vtaCenter. 

I do so:

procedure TForm2.AdvStringGrid1GetAlignment(Sender: TObject; ARow,
  ACol: Integer; var HAlign: TAlignment; var VAlign: TVAlignment);
if ARow = 0 then
    VAlign := vtaCenter;

procedure TForm2.FormCreate(Sender: TObject);
  AdvStringGrid1.RowHeights [0] := 50;
  AdvStringGrid1.Cells[0, 0] := '22';

As a result of this code, there is no alignment = vtaCenter.

How can I make the text alignment vertical vtaCenter?

Version of TAdvStringGrid  =

To enable vertically centered alignment, make sure to set grid.WordWrap to false.

Thank you very much, it worked! But where is the logic?

Vertical alignment and wordwrap are mutually exclusive. This is due to a limitation in the Microsoft Windows text drawing API that does not allow to have wordwrapped text with other vertical alignment than top alignment.

Ок, thanks a lot!

I know this is an old thread... What if you want word wrapping enabled - i.e. you have more than line of text displayed in your grid cell - and you also want centered vertical alignment?