I have a one-row TStringGrid, which has only two columns.
(I use a one-row TStringGrid here for appearance purposes, as it provides the total values for the rows in another TStringGrid that appears above it on my form.)
I want to right align the text.
When I run it, the first column shows both text and both left-aligned and right-aligned (e.g. 44.72 44.72), but the second column just shows the right-aligned text.
I can't work out how to get rid of the bogus left-aligned data.
Here is the code, which is fairly standard:
procedure TfTrans.sgTotalsDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
with sgTotals do
SavedAlign := SetTextAlign(Canvas.Handle, TA_RIGHT);
SaveString := Cells[ACol,ARow];
Rect.Right - 4, Rect.Top + 2, SaveString);