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
|
procedure TStringGrid.Init(colcnt, rowcnt, width, height: integer);
var
i, j: integer;
w, h: Number;
begin
colcount := colcnt;
rowcount := rowcnt;
w := Trunc(width / colcount);
h := Trunc(height / rowcount);
opaqueBackground := LightSteelBlue;
for i := 0 to colcount-1 do
for j := 0 to rowcount-1 do
begin
cells[i,j] := TCell.Create(self);
cells[i,j].background := true;
cells[i,j].backgroundColor := white;
cells[i,j].width := w - 1;
cells[i,j].height := h - 1;
cells[i,j].left := 1 + i * w;
cells[i,j].top := 1 + j * h;
cells[i,j].text := '';
end;
end; |
Partager