是这样的:
在StringGrid控件中嵌入一个combobox控件!当A列被选中后,combobx控件才显示出来!当用鍵盘上的向左光标键调节到A列时,combobox控件没显示出来?
我不知道为什么?
在StringGrid控件中嵌入一个combobox控件!当A列被选中后,combobx控件才显示出来!当用鍵盘上的向左光标键调节到A列时,combobox控件没显示出来?
我不知道为什么?
解决方案 »
- 控件能作为数组调用吗?
- 用Delphi如何写一个md5加密算法啊???请教!!
- 请问:是不是用ADOQuery这个控件只能实现查询?更新操作不行吗?
- 和小I聊了一下
- 怎么判断两台机器是否连接上了,用网线。 在线等。急
- 急需Tppdesigner控件,請提供下載地址!非常感謝!在線等待!!!
- 我想把一个string强制转换为TADOQuery类型,可不可以?
- 如何使报表预览时显示在最顶端(窗体的最前面)?
- 请教关于perform()函数的用法!
- 急! adoquery 在open后使用 append 方法后再使用 delete 方法出现错误
- 怎么把图片在StringGrid的Cells[i,j]显示出来?
- 过年了,最后一个问题,进来给分!(马上结帖)
ARow: Integer; Rect: TRect; State: TGridDrawState);if (gdFocused in State) and (Trim(StringGrid1.Cells[acol,0])='抄表标志') then
begin
LI_I:=ACol; LI_J:=ARow;
combobox1.Text:=stringgrid1.Cells[ACol,ARow];
combobox1.Top:=Rect.Top+StringGrid1.top+3;
combobox1.Left:=Rect.Left+StringGrid1.Left+3;
combobox1.Height:=Rect.Bottom-Rect.Top;
combobox1.Width:=Rect.Right-Rect.Left;
combobox1.Visible:=true;
combobox1.Text:='';
LB_CBBZ:=false;
combobox1.Update;
combobox1.SetFocus;
end;当然,用鼠标点击目标列,可以看到combobox控件,
但是不用鼠标点击,就用鍵盘上的光标键来选择小格子,当用向左光标键从右向左
调动时,调动到目标列时,就看不到这个combobox控件!所以我才提出如何调用StringGrid控件的DrawCell事件!
分不够的话,可以再加 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
begin
//here your code is ok;
end;
DrawCell = WM_USER + 1;procedure STRINGGRID(var Msg: TMessage); message FHLM_STRINGGRID;
...procedure STRINGGRID.DrawCell(var Msg: TMessage);
begin
DrawCell;
end;
procedure TSTRINGGRID.DrawCell(...);
begin
if Assigned(FOnDrawCell) then FOnDrawCell(Self);
end;const
DrawCell = WM_USER + 1;procedure STRINGGRID(var Msg: TMessage); message STRINGGRID;
...procedure TSTRINGGRID.DrawCell(var Msg: TMessage);
begin
DrawCell;
end;
并用stringgrid1.Selection.属性固定位置。
这样
if acol=1 then
begin Button1.Left :=stringgrid1.left+stringgrid1.CellRect(ACol,arow).Left;
Button1.Top :=stringgrid1.Top+stringgrid1.CellRect(ACol,arow).top;
button1.Visible :=true;
end else
button1.Visible :=false;