stringggridselectcell();事件如果你点击第一列 var Trect; begin If acol=0 then begin a:=stringgrid1.cellrect(Acol,Arow); a.left:=a.left+stinggrid1.left; a.right:=a.right+stringgrid1.left; a.top:=a.top+stringgrid1.top; a.botom:=a. +stringgrid1.top; Combobox1.left:=a.left+2; Combobox1.top:=a.top+3; Combobox1.width:=stringgrid1.colwiedths{acol]; combobox1.heigth:=stringgrid1.rowheight[arow]; COmbbobx1.visible:=true; Combobox1.setfocus; end; canselect :=true; end;
具体实现:写单元格点击事件,得到top,left属性,然后创建控件,把它移到该位置,当点击别的区域时,进行隐藏.要具体的可留下邮箱!
var Trect;
begin
If acol=0 then
begin
a:=stringgrid1.cellrect(Acol,Arow);
a.left:=a.left+stinggrid1.left;
a.right:=a.right+stringgrid1.left;
a.top:=a.top+stringgrid1.top;
a.botom:=a. +stringgrid1.top;
Combobox1.left:=a.left+2;
Combobox1.top:=a.top+3;
Combobox1.width:=stringgrid1.colwiedths{acol];
combobox1.heigth:=stringgrid1.rowheight[arow];
COmbbobx1.visible:=true;
Combobox1.setfocus;
end;
canselect :=true;
end;