>>Nose:是不是自找麻烦?
>>xxy:为什么不用PickList?
Picklist自己生成Items
DBGrid1.Columns.Items.picklist.Add(dwtable.filedbyname('dwbh').asstring+' '+dwtable.fieldbyname('dwmc').asstring)
"输入时自动显示下拉列表"可参考:
procedure TYourForm.DBGrid1CellClick(Column: TColumn);
begin
keybd_event(VK_F2,0,0,0);
keybd_event(VK_F2,0,KEYEVENTF_KEYUP,0);
with TDBGrid(ActiveControl) do
if DBGrid1.Columns[selectedindex].picklist.count<>0 then
begin
keybd_event(VK_MENU,0,0,0);
keybd_event(VK_DOWN,0,0,0);
keybd_event(VK_DOWN,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
end;
end;