unit ComplexForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  BaseForm, AnyPrint, AnyGrids, ComCtrls, Buttons, ExtCtrls;

type
  TfrmComplex = class(TfrmBase)
    procedure FormCreate(Sender: TObject);
    procedure AnyGridGetText(Sender: TObject; Row, Col: Integer;
      var Text: WideString);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmComplex: TfrmComplex;

implementation

{$R *.DFM}

procedure TfrmComplex.FormCreate(Sender: TObject);
var
  i,j:integer;
begin
  inherited;
  AnyGrid.BeginUpdate;
  try
    AnyGrid.Options:=AnyGrid.Options-[agoShowExcelTitle];
    AnyGrid.FixRowCount:=2;
    AnyGrid.FixColCount:=1;
    for i:=0 to AnyGrid.FixRowCount-1 do
      for j:=0 to AnyGrid.Cols-1 do
      begin
        AnyGrid.Cells(i,j).Ctl3D:=True;
        AnyGrid.Cells(i,j).FixCell:=True;
      end;
    for i:=0 to AnyGrid.Rows-1 do
        AnyGrid.Cells(i,0).Ctl3D:=True;
    AnyGrid.Columns(0).HorAlignment:=taCenter;
    AnyGrid.Columns(0).FixCell:=True;
    Report.TitleRows:=AnyGrid.FixRowCount;
    Report.ColorPrinter:=False;
  finally
    AnyGrid.EndUpdate;
  end;
end;

procedure TfrmComplex.AnyGridGetText(Sender: TObject; Row, Col: Integer;
  var Text: WideString);
begin
  if Col<>0 then Exit;
  if Row>=AnyGrid.FixRowCount then
    Text:=IntToStr(Row-AnyGrid.FixRowCount+1)
  else
    Text:='';
end;

end.
