Cells[2,1] 其数据唯读..

解决方案 »

  1.   

    你在StringGrid的KeyDown 事件中:
    with StringGrid do
       if (Col = 2) and (Row = 1) then Key :=0 
      

  2.   

    KeyDown中无效,要在KeyPress中:
    procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char);
    begin
      if (StringGrid1.Col = 2) and (StringGrid1.Row = 1) then
      Key := #0
    end;
      

  3.   

    可以试一试
    procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
      ARow: Integer; var CanSelect: Boolean);
    begin
        if (Acol=0)  then
        begin
           canselect := False;
           exit;
        end;
        showmessage(StringGrid1.Cells[acol,arow]);
    end;