Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
{Right-adjusts text in a given TRect on a given TCanvas.
Useful for handling OnDrawCell events. See also WINAPI DrawText().}
procedure RightAdjustText( Canvas:TCanvas; Rect:TRect; Text:string );
var
nLeft: integer;
begin
nLeft := Rect.Left + (Rect.Right - Rect.Left) - (Canvas.TextWidth(Text)) - 2;
if nLeft < Rect.Left then nLeft := Rect.Left;
Canvas.TextRect( Rect, nLeft, Rect.Top+2, Text );
end;
{Custom formatting On DrawCell event...}
procedure TfrmMain.gridMainDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
if (ACol = 2) and (ARow > 0) then
with gridMain do
RightAdjustText( Canvas, Rect, Cells[ACol,ARow] );
end;