加checkbox
for i := 0 to sg.RowCount - 1 do
begin
sg.AddCheckBox(1,i,false,false);
for j := 0 to sg.ColCount - 1 do
begin
if j <> 1 then
sg.CellProperties[j,i].ReadOnly := true;//只读
end;
end;
读取,设置checkbox,全选,反选
procedure TFormBasicSetup.sgDishesMenuClickCell(Sender: TObject; ARow,
ACol: Integer);
var
b: Boolean;
procedure SelectAll(b: boolean);
var
i: Integer;
begin
for i := 0 to sgDishesMenu.RowCount - 1 do
begin
sgDishesMenu.SetCheckBoxState(1,i,b);
end;
end;
begin
if (ACol = 1) and (ARow = 0) then
begin
sgDishesMenu.GetCheckBoxState(1,0,b);
b := not b;
selectall(b);
end;
end;