我用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加一句代码,上叙代码未执行,好像就没有运行此类中的画。请问大侠如何解决此问题~~~~
大家随便说说自己的想法~~~~~
真的很急。谢谢大家~~~~~~~
代码:
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加一句代码,上叙代码未执行,好像就没有运行此类中的画。请问大侠如何解决此问题~~~~
大家随便说说自己的想法~~~~~
真的很急。谢谢大家~~~~~~~
xxxx;
inherited DrawColumnCell(Rect, DataCol, Column, State);
出现错误提示:Stck overflow
溢出~~~~~
好像是无限循环了
begin
inherited ;
//你的代码
end;
只加一句inherited;无法编译通过~~~
Error: Incompatible typesto viaboy(平凡):谢谢
最好不要动态创建