原理:DELPHI提供了重新绘制网络的机制,所以可以使用ondrawdatacell事件来做到这种方式。
方法:
1、放一个LOOKUPCOMBOBOX在grid周围?
2、procedure TForm1.stringGrid1drawdatecall(....)
begin
if (gdfocused in state) then
begin
with lookupcombobox1 do
left:=rect.left+stringgrid1.left;
top:=rect.top+stringgrid1.top;
width:=rect.right-rect.left;
height:=rect.bottom-rect.top;
visible:=true;
end;
end;
3.procedure tform1.stringgrid1colexit(....)
begin
lookupcombobox1.visible:=false;
end4. procedure TFORM1.stringgrid1keypress(...)
begin
if(key<>chr(9) then
lookupcombobox1.setfocus;
sendmessage(LookupCombobox1.handle,wm_char,word(key),0);
end;
5.Tform1.formshow(..)
begin
lookupcombobx1.visible:=false;
end;手都酸了,不知道有没有记错?
方法:
1、放一个LOOKUPCOMBOBOX在grid周围?
2、procedure TForm1.stringGrid1drawdatecall(....)
begin
if (gdfocused in state) then
begin
with lookupcombobox1 do
left:=rect.left+stringgrid1.left;
top:=rect.top+stringgrid1.top;
width:=rect.right-rect.left;
height:=rect.bottom-rect.top;
visible:=true;
end;
end;
3.procedure tform1.stringgrid1colexit(....)
begin
lookupcombobox1.visible:=false;
end4. procedure TFORM1.stringgrid1keypress(...)
begin
if(key<>chr(9) then
lookupcombobox1.setfocus;
sendmessage(LookupCombobox1.handle,wm_char,word(key),0);
end;
5.Tform1.formshow(..)
begin
lookupcombobx1.visible:=false;
end;手都酸了,不知道有没有记错?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货