Kopf hoch - du schaffst das:
Delphi-Quellcode:
procedure FillGrid(sg: TStringGrid; bits: Byte);
var
iCol, iRow, iRows: Integer;
begin
iRows := 1 shl bits;
with sg do
begin
ColCount := bits;
RowCount := iRows + FixedRows;
for iCol := 1 to ColCount do
for iRow := 0 to Pred(iRows) do
Cells[ColCount - iCol, FixedRows + iRow] := IntToStr(Ord(Odd(iRow shr Pred(iCol))));
end;
end;
procedure TDemoForm.SpinEditChange(Sender: TObject);
begin
FillGrid(StringGrid, SpinEdit.Value);
end;
Freundliche Grüße vom marabu