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