1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FMX.Grid.Style, FMX.StdCtrls, FMX.ScrollBox, FMX.Grid,
FMX.Controls.Presentation, FMX.Edit, FMX.EditBox, FMX.SpinBox;
type
TForm2 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
grid: TStringGrid;
CornerButton1: TCornerButton;
CornerButton2: TCornerButton;
SpinBox1: TSpinBox;
CornerButton3: TCornerButton;
Label1: TLabel;
Label2: TLabel;
procedure CornerButton1Click(Sender: TObject);
procedure CornerButton2Click(Sender: TObject);
procedure CornerButton3Click(Sender: TObject);
private
procedure NumeroteCol;
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form2: TForm2;
implementation
{$R *.fmx}
procedure TForm2.NumeroteCol;
begin
For var i:=0 to grid.Columncount-1 do
grid.cells[i,0]:=i.tostring;
end;
procedure TForm2.CornerButton1Click(Sender: TObject);
var
SCol: TStringColumn;
begin
SCol:=TStringColumn.create(grid);
SCol.HeaderSettings.TextSettings.HorzAlign:=TTextAlign.Center;
SCol.Header:='Ajout '+grid.columncount.tostring;
SCol.width:=80;
grid.addobject(SCol);
Label2.Text:=grid.ColumnCount.ToString;
NumeroteCol
end;
procedure TForm2.CornerButton2Click(Sender: TObject);
var
SCol: TStringColumn;
begin
SCol:=TStringColumn.create(grid);
SCol.HeaderSettings.TextSettings.HorzAlign:=TTextAlign.Center;
SCol.Header:='Insert '+round(spinbox1.value).ToString;
SCol.width:=80;
grid.insertobject(round(spinbox1.value), SCol);
Label2.Text:=grid.ColumnCount.ToString;
NumeroteCol
end;
procedure TForm2.CornerButton3Click(Sender: TObject);
begin
grid.Columns[round(spinbox1.value)].Free;
Label2.Text:=grid.ColumnCount.ToString;
NumeroteCol
end;
end. |
Partager