我用DBGridEh派生了一个新的控件,将一个Edit画在DBGridEh的一个列上。
代码:
procedure DrawColumnCell(Sender: TObject;
              const Rect: TRect; DataCol: Integer; Column: TColumnEh;
              State: TGridDrawState);
begin
    if (gdFocused in State) then
    begin
      if Column.Index = CalDBGridIndex('GoodsNo') then
      begin
        //**************控制Edit*************//
        EDT_Absord.Clear;
        EDT_Absord.Left := Rect.Left;
        EDT_Absord.Top := Rect.Top;
        EDT_Absord.Height := Rect.Bottom - Rect.Top ;
        EDT_Absord.Visible := True;
        EDT_Absord.SetFocus;
end;
  Self.OnDrawColumnCell := DrawColumnCell;在窗体上加入此控件,运行没有问题。但如果在此控件的DrawColumnCell加一句代码,上叙代码未执行,好像就没有运行此类中的画。请问大侠如何解决此问题~~~~
大家随便说说自己的想法~~~~~
真的很急。谢谢大家~~~~~~~

解决方案 »

  1.   

    调用一个Inherited DrawColumnCell(xxx,xxx...)试试
      

  2.   

    在你的DrawColumnCell加上一句代码的前面写Inherited ;
    xxxx;
      

  3.   

    试过了,调用
        inherited DrawColumnCell(Rect, DataCol, Column, State);
    出现错误提示:Stck overflow
    溢出~~~~~
    好像是无限循环了
      

  4.   

    DrawColumnCell(Rect, DataCol, Column, State);
    begin
     inherited ;
     //你的代码
    end;
      

  5.   

    to jinjazz(我是jin) :
      只加一句inherited;无法编译通过~~~
      Error:  Incompatible typesto  viaboy(平凡):谢谢
      

  6.   

    你的EDIT是不是动态创建的
    最好不要动态创建
      

  7.   

    但是Edit是我这个派生控件的子控件啊~~~~~