1,用picklist 2,在dbgrid中画一个啊在drawdatacell事件中 if (gdfocused in state) then begin if (field.fieldname=dbcombobox.datafield) then begin dbcombobox1.left:=rect.left+dbgrid1.left dbcombobox1.top:=rect.top+dbgrid1.top; dbcombobox1.width:=rect.right-rect.left; dbcombobox1.height:=rect.botton-rect.top; dbcombobox1.visible:=true; end; end; 在colexit事件中 if dbgrid1.selectedfield.fieldname=dbcombobox1.datafield then dbcombobox1.visible:=false; 在keypress事件中 if (key<>chr(9)) then begin if(dbgrid1.selectedfield.fieldname=dbcombobo1.datafield) then begin dbcombobox1.setfocus; sendMessage(dbcombobox1.handle,wm_char,word(key),0); end; end; 3,使用api函数 api函数为:drawframecontrol()
自己到help里查查吧
dbgrid.picklist.add(); etc
2,在dbgrid中画一个啊在drawdatacell事件中
if (gdfocused in state) then
begin
if (field.fieldname=dbcombobox.datafield) then
begin
dbcombobox1.left:=rect.left+dbgrid1.left
dbcombobox1.top:=rect.top+dbgrid1.top;
dbcombobox1.width:=rect.right-rect.left;
dbcombobox1.height:=rect.botton-rect.top;
dbcombobox1.visible:=true;
end;
end;
在colexit事件中
if dbgrid1.selectedfield.fieldname=dbcombobox1.datafield then
dbcombobox1.visible:=false;
在keypress事件中
if (key<>chr(9)) then
begin
if(dbgrid1.selectedfield.fieldname=dbcombobo1.datafield) then
begin
dbcombobox1.setfocus;
sendMessage(dbcombobox1.handle,wm_char,word(key),0);
end;
end;
3,使用api函数
api函数为:drawframecontrol()