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
|
...
{$R *.dfm}
var CActiv:integer;
LActiv:integer;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1.Canvas do
begin
if (Acol<>0) and (Arow<>0) then
if (Acol=CActiv) and (Arow=LActiv) then
begin
brush.Color:=clred;
fillrect(Rect);
end;
end;
end;
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
StringGrid1.MouseToCell(X,Y,CActiv,LActiv);
label1.caption:=inttostr(CActiv)+','+inttostr(LActiv);
end; |
Partager