我不是很明白你的意思,不知下面的代码能不能满足你的要求;procedure TForm1.StringGrid1Click(Sender: TObject);
begin
  if StringGrid1.Cells[StringGrid1.col,StringGrid1.row]='yes' then
    StringGrid1.Cells[StringGrid1.col,StringGrid1.row]:='no'
  else
    StringGrid1.Cells[StringGrid1.col,StringGrid1.row]:='yes';end;

解决方案 »

  1.   

    我的意思是:首先将stringgrid的fixrows和fixcols设为1,这时,如果鼠标在stringgrid1.cells[0,1]上单击时,将stringgrid1.cells[0,1]的内容改变。
      

  2.   

    redwoodnymph(红蜂鸟):你的方法不能满足要求,我想做到的是只有单击固定单元格时才对固定单元格的内容改变。
      

  3.   

    redwoodnymph(红蜂鸟):你的代码是将所单击的单元格的内容改变。可是我单击fix的单元格就不能实现了。我的意思是当stringgrid1的fixcols属性设为1时,在stringgrid1的左边不是有一列是标题列吗,我要的是当点击这一列的单元格时才对该列的单元格的内容进行改变。
      

  4.   

    怎么解决了都不给答案啊?...我来给员马:
    procedure TForm1.sgrdMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var
      C, R: Integer;
    begin
      sgrd.MouseToCell(ScreenToClient(Mouse.CursorPos).x, ScreenToClient(Mouse.CursorPos).Y, C, R);
      if sgrd.cells[C,R - 2] = '+' then sgrd.cells[C, R - 2] := '-' else sgrd.cells[C, R - 2] := '+';
    end;