unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, NxColumns6, NxGridView6, NxControls6,
  NxCustomGrid6, NxVirtualGrid6, NxGrid6, Vcl.StdCtrls, Vcl.Imaging.Jpeg, NxTypes6;

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    NxReportGridView61: TNxReportGridView6;
    NxTextColumn61: TNxTextColumn6;
    NxGraphicColumn61: TNxGraphicColumn6;
    Button1: TButton;
    ComboBox1: TComboBox;
    NxSlidesGridView61: TNxSlidesGridView6;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    Images: array[0..1] of TGraphic;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  NextGrid61.AddRow;
  NextGrid61.Cell[NxGraphicColumn61.Index, NextGrid61.LastAddedRow].Data := Images[0];

  NextGrid61.AddRow;
  NextGrid61.Cell[NxGraphicColumn61.Index, NextGrid61.LastAddedRow].Data := Images[1];
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
var
  s: string;
begin
  s := ComboBox1.Items[ComboBox1.ItemIndex];
  if s = 'fmAspectFill' then NxGraphicColumn61.FillMode := fmAspectFill;
  if s = 'fmAspectFit' then NxGraphicColumn61.FillMode := fmAspectFit;
  if s = 'fmCenter' then NxGraphicColumn61.FillMode := fmCenter;
  if s = 'fmScaleToFill' then NxGraphicColumn61.FillMode := fmScaleToFill;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  Image: TJPEGImage;
begin
  Image := TJPEGImage.Create;
  Image.LoadFromFile('pictures\waterfall.jpg');

  Images[0] := Image;

  Image := TJPEGImage.Create;
  Image.LoadFromFile('pictures\flower.jpg');

  Images[1] := Image;

  ComboBox1.ItemIndex := 1;
end;

procedure TForm1.FormDestroy(Sender: TObject);
var
  i: Integer;
begin
  for i := Low(Images) to High(Images) do Images[i].Free;
end;

end.
