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: 79: 80: 81: 82: 83: 84: 85: 86:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, StdCtrls;
type TForm1 = class(TForm) StringGrid1: TStringGrid; ComboBox1: TComboBox; ComboBox2: TComboBox; Button1: TButton; procedure ComboBox1Change(Sender: TObject); procedure ComboBox2Change(Sender: TObject); procedure Button1Click(Sender: TObject); private public end;
var Form1: TForm1; daten : array of array of string;
implementation
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject); begin case ComboBox1.ItemIndex of 0: stringgrid1.ColCount := 1; 1: stringgrid1.ColCount := 7; 2: stringgrid1.ColCount := 9; 3: stringgrid1.ColCount := 11; 4: stringgrid1.ColCount := 13; 5: stringgrid1.ColCount := 15; 6: stringgrid1.ColCount := 17; 7: stringgrid1.ColCount := 19; 8: stringgrid1.ColCount := 21;
end; end;
procedure TForm1.ComboBox2Change(Sender: TObject); begin case ComboBox2.ItemIndex of 0: stringgrid1.rowCount := 1; 1: stringgrid1.rowCount := 2; 2: stringgrid1.rowCount := 3; 3: stringgrid1.rowCount := 4; 4: stringgrid1.rowCount := 5; 5: stringgrid1.rowCount := 6; 6: stringgrid1.rowCount := 7; 7: stringgrid1.rowCount := 8; 8: stringgrid1.rowCount := 9; 9: stringgrid1.rowCount := 10; 10:stringgrid1.rowCount := 11;
end; end;
procedure TForm1.Button1Click(Sender: TObject); var i, j : integer; begin for i := 0 to (stringgrid1.RowCount-1) do for j := 0 to (stringgrid1.ColCount-1) do begin stringgrid1.Cells[j,i] := inttostr(j)+inttostr(i); end;
SetLength(daten,(stringgrid1.rowcount),(stringgrid1.ColCount)); for i := 0 to (stringgrid1.RowCount) do for j := 0 to(stringgrid1.ColCount) do begin daten[j,i] := stringgrid1.Cells[j,i]; end;
end;
end. |