如何隐藏一个父类的public属性? 我从TListView派生,希望隐藏OnCustomDrawItem属性,于是将其设为protected,但是他还是在Events列表里为什么?怎么做才能隐藏他? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 父类的PUBLIC属性自动继承,这怎么隐藏啊??除非你不从TLISTVIEW继承; 或者可以这样,把OnCustomDrawItem声明为只读属性unit MyListView;interfaceuses Windows, Messages, SysUtils, Classes, Controls, ComCtrls;type TMyListView = class(TListView) private { Private declarations } FOnCustomDrawItem: TLVCustomDrawItemEvent; protected { Protected declarations } public { Public declarations } published { Published declarations } property OnCustomDrawItem: TLVCustomDrawItemEvent read FOnCustomDrawItem; end;procedure Register;implementationprocedure Register;begin RegisterComponents('GybCtrl', [TMyListView]);end;{ TMyListView }end. 是啊,父类的Pulished属性都是自动继承的。怎么做呢!关注!!!! 把父类的某一Published属性重新声明为只读或只写属性这一属性就不会在Object Inspector上出现 哦如果设为有没有什么办法将他只付一次值,就像const那样。我这样写,但是报错: property OnCustomDrawItem:TLVCustomDrawItemEvent read FOnCustomDrawItem default DrawColoredItem;[Error] AutoLV.pas(183): Field or method identifier expectedDrawColoredItem是自己的自画handler. 那就这样,加一Constructorconstructor TMyListView.Create(AOwner: TComponent);begin inherited; inherited OnCustomDrawItem := DrawColoredItem;end; 好了好了!谢谢大家。不用再从TCistomListView派生了,写一大串property.... Delphi病毒 我有20个文本文件,把里面重复的数据查找出来的方法? 关于Delphi和access的非法访问问题 我想在DBGrid中修改数据并且更新数据文件,但是Dataset readonly,怎么解决呢? TNMSMTP控件如何实现SMTP认证功能?高手请解答。 如何设计类的问题? VB & Delphi 在delphi里怎么调用c的函数 求救!!!我快疯了? 请问如何在按CTRL+ALT+DEL时弹出的对话框里隐藏自己的程序? 菜鸟问题:我在IMAGE中画了一条曲线,用什么方法把它擦除掉 有关ftp的操作
Windows, Messages, SysUtils, Classes, Controls, ComCtrls;type
TMyListView = class(TListView)
private
{ Private declarations }
FOnCustomDrawItem: TLVCustomDrawItemEvent;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property OnCustomDrawItem: TLVCustomDrawItemEvent read FOnCustomDrawItem;
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('GybCtrl', [TMyListView]);
end;{ TMyListView }
end.
关注!!!!
这一属性就不会在Object Inspector上出现
constructor TMyListView.Create(AOwner: TComponent);
begin
inherited;
inherited OnCustomDrawItem := DrawColoredItem;
end;