Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if gdSelected in State then
ImageList1.Draw(DrawGrid1.Canvas,rect.Left,Rect.Top,0);
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
StringGrid1.Cells[acol,arow]:='a';
end;
var CellList : array of TPoint
...
procedure TForm1.DrawGrid1SelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
var I : integer;
TP : TPoint;
Found : boolean;
begin
TP.X:=ACol;
TP.Y:=ARow;
Found:=False;
if High(CellList) > -1 then
begin
for I:=Low(CellList) to High(CellList) do
begin
Found:=(TP.X = CellList[I].X) and (TP.Y = CellList[I].Y);
if Found then Break;
end;
end
else
Found:=False;
if not Found then
begin
// create space in array
SetLength(CellList, High(CellList)+2);
// add coords to array
CellList[High(CellList)]:=TP;
end;
end;
procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var I : integer;
TP : TPoint;
Found : boolean;
begin
TP.X:=ACol;
TP.Y:=ARow;
Found:=False;
if High(CellList) > -1 then
begin
for I:=Low(CellList) to High(CellList) do
begin
Found:=(TP.X = CellList[I].X) and (TP.Y = CellList[I].Y);
if Found then Break;
end;
end
else
Found:=False;
if Found then
begin
// draw the cell
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
n: Integer;
begin
n := StrToIntDef(StringGrid1.Cells[ACol,ARow],-1);
if n > -0 then
ImageList1.Draw(StringGrid1.Canvas,Rect.Left,Rect.Top,n);
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
if StringGrid1.Cells[ACol,ARow] = '' then
StringGrid1.Cells[ACol,ARow] := '1' // image number
else
StringGrid1.Cells[ACol,ARow] := '';
StringGrid1.Invalidate;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
n: Integer;
begin
n := StrToIntDef(StringGrid1.Cells[ACol,ARow],-1);
if n >= 0 then
ImageList1.Draw(StringGrid1.Canvas,Rect.Left,Rect.Top,n);
end;