问题同标题!回答问题的同志请注意一下不要理解错了我先说明我不是想要知道什么,StringGrid的Options[goRowSelect]之类的东西!我只是想在代码中实现任意多个Cells的选中!请问大家如何实现?

解决方案 »

  1.   

    procedure TForm1.Button2Click(Sender: TObject);
    var
        myRect: TGridRect;
    begin
        myRect.Left := 3;
        myRect.Top := 1;
        myRect.Right := 2;
        myRect.Bottom := 4;
        StringGrid1.Selection := myRect;
    end;
      

  2.   

    procedure TForm1.Button2Click(Sender: TObject);
    var
        myRect: TGridRect;
    begin
        myRect.Left := 3;
        myRect.Top := 1;
        myRect.Right := 2;
        myRect.Bottom := 4;
        StringGrid1.Selection := myRect;
    end;
      

  3.   

    没办法,自己写吧,定一个SELECTLIST记录你选中的格子,在DRAWCELL中重画这些格子,STRINGGRID功能很弱,不要指望它能为你做太多的事