StringGrid  控件 默认没有选定单元格 ,设定那个属性
  然后怎样判断是否 选定 某个单元格  用什么判断??
谢谢

解决方案 »

  1.   

    不明白你要做什么?Row,Col属性应时当前选定的单元格啊,默认选定(1,1)单元格判断是否选定(Col,Row)单元格,自己写个函数就行了unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, Grids;type
      TForm1 = class(TForm)
        StringGrid1: TStringGrid;
        BitBtn1: TBitBtn;
        procedure BitBtn1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
        function isSelect(Row,Col: integer): boolean;
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      showMessage(inttostr(stringgrid1.Row)+','+inttostr(stringgrid1.Col));
      ShowMessage(booltoStr(isSelect(3,3)));
    end;function TForm1.isSelect(Row, Col:integer): boolean;
    begin
      Result:= (StringGrid1.Row=Row) and (StringGrid1.Col=Col);
    end;end.