unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    NxReportGridView1: TNxReportGridView6;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    NxTextColumn61: TNxTextColumn6;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    Button10: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure NextGrid61MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormCreate(Sender: TObject);
    procedure Button10Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button10Click(Sender: TObject);
begin
  NextGrid61.Serialize.SaveToINI('c:\temp\proba.ini');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  NextGrid61.Columns.Add(TNxTextColumn6, 'Test ' + IntToStr(NextGrid61.Columns.Count));
  Caption := IntToStr(NextGrid61.Columns.VisibleWidth);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  NextGrid61.AddRow;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  NextGrid61.Columns[1].AutoSize := True;
  NextGrid61.Columns[2].AutoSize := True;
//  NextGrid61.Columns.ResizeColumns(NextGrid61.ClientWidth);
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  NextGrid61.Columns[3].AutoSize := True;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  NextGrid61.ActiveView.HeaderHeight := 200;
  NextGrid61.Columns[0].Header.Orientation := orVertical;
//  Canvas.Font.Orientation
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  NextGrid61.Columns[0].Header.Alignment := taRightJustify;
//  NextGrid61.Columns[0].Header.Alignment := taCenter
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
  NextGrid61.Columns[0].Header.DisplayMode := dmTextOnly;
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
  NextGrid61.Columns[0].Header.Alignment := taCenter;

end;

procedure TForm1.Button9Click(Sender: TObject);
begin
  NextGrid61.Columns[0].Header.Caption := 'Boka' + #13#10 + 'Laza';
  NextGrid61.ActiveView.HeaderHeight := 24;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  NextGrid61.Options := NextGrid61.Options + [goExitEndEditing];
end;

procedure TForm1.NextGrid61MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  CellAtPos: TPoint;
  CellRect, ButtonRect: TRect;
begin
  CellAtPos := NextGrid61.ActiveView.GetCellAtPos(Point(X, Y));
  CellRect := NextGrid61.ActiveView.GetCellRect(CellAtPos);
  ButtonRect := CellRect;
  ButtonRect.Width := ButtonRect.Height;
  if PtInRect(ButtonRect, Point(X, Y)) then
  begin
    NextGrid61.IgnoreEditing;
  end;
end;

end.
