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
| procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
i, j: integer;
begin
if Button = mbRight then
begin
j:=StringGrid1.Selection.Top;
If MessageDlg('Disable row '+IntToStr(j),
mtConfirmation, [mbYes, mbNo], 0, mbYes) =mrYes then
begin
With Stringgrid1 As TStringGrid Do
With Canvas Do
begin
for i := 0 to 2 do
begin
Rect := CellRect (i, StringGrid1.Selection.Top);
Font.Style := Font.Style + [fsStrikeOut];
FillRect(Rect);
DrawText(Canvas.Handle, PChar(Cells[i,j]), -1, Rect ,DT_CENTER );
end;
end;
end;
end;
end; |
Partager