StringGrid子类的DrawCell事件如何重新定义?(100分)

  • 主题发起人 ibmdeskstar
  • 开始时间
I

ibmdeskstar

Unregistered / Unconfirmed
GUEST, unregistred user!
因为需要一些特殊的功能,所以要写一个控件,是StringGrid的子类

Unit MyComponent;
interface
uses ...
type
TMyStringGrid = class(TStringGrid)
private
procedure DrawCell(Sender:TObject;Acol,ARow:Integer;Rect:TRect;State:TGridDrawState);override;
public
constructor Create(AWoner:TComponent);override;
end;
....
end;

安装控件的时候告知因为TStringGrid里边的DrawCell被定义为private的过程,所以不能override,
可是我确实需要重写这个子类的DrawCell代码,如何做到?谢谢

 
强制转换如何
 
如何强制转换?请教具体方法
 
你用D6?
在D5里DrawCell是protected 而不是private
你的声明有问题,DrawCell应该没有Sender参数,你去掉它看看
另外把DrawCell声明成Protected吧,TStringGrid的DrawCell应该是Protected,否则要继承TStingGrid就麻烦了
 
protected
procedure DrawCell(ACol, ARow: Longint; ARect: TRect;AState: TGridDrawState); override;
 
顶部