dbgrid中的可以这样做,放一个dbcheck在form中,visible=false;
procedure TForm1.dbgriddrawcolumcell(..);
begin
if (dbfocused in state) and(column.field=table1senior) then
begin
dbcheckbox1.setbounds(rect.left+dbgrid1.left+1,
rect.top+dbgrid1.top+1,
rect.right-rect.left,
rect.bottom-rect.top);
end;
end;
procedure TForm1.dbgrid1colenter(..);
begin
if dbgird1.columns[dbgrid1.selectedindex].field=tablesenior then
dbcheckbox1.visible:=true
else
dbcheckbox1.visible:=false;
end;
procedure TForm1.dbgird1keypress(..);
begin
if dbcheckbox1.visible and(ord(key)>31) then
begin
key:=#0;
table1.edit;
dbcheckbox1.checked:=not checkbox1.checked;
dbcheckbox1.field.asboolean:=dbcheckbox1.checked;
end;
end;