S
smokingroom
Unregistered / Unconfirmed
GUEST, unregistred user!
我正嘗試在寫一個DBTreeViewEx控件,基本完成,很快可以與大家共享.現在有個問題,我想重載TTreeView中的
OnChanging,OnCollapsed,OnExpanded等事件,但卻報錯說找不到父類中的方法.實在沒辦法了,
只好向高手求救.
TDBTreeViewEx = class(TTreeView)
private
{ Private declarations }
...
protected
Procedure Changing(Sender:TObject;Node:TTreeNode;Var AllowChange:Boolean);override;
procedure Collapsed(Sender: TObject; Node: TTreeNode);override;
procedure Expanded(Sender: TObject; Node: TTreeNode);override;
{ Protected declarations }
public
Constructor Create(Owner:TComponent);Override;
...
{ Public declarations }
published
...
{ Published declarations }
end;
procedure TDBTreeViewEX.Collapsed(Sender: TObject; Node: TTreeNode);
begin
Node.ImageIndex:=0;
inherited;
end;
procedure TDBTreeViewEx.Expanded(Sender: TObject; Node: TTreeNode);
begin
Node.ImageIndex:=2;
inherited;
end;
OnChanging,OnCollapsed,OnExpanded等事件,但卻報錯說找不到父類中的方法.實在沒辦法了,
只好向高手求救.
TDBTreeViewEx = class(TTreeView)
private
{ Private declarations }
...
protected
Procedure Changing(Sender:TObject;Node:TTreeNode;Var AllowChange:Boolean);override;
procedure Collapsed(Sender: TObject; Node: TTreeNode);override;
procedure Expanded(Sender: TObject; Node: TTreeNode);override;
{ Protected declarations }
public
Constructor Create(Owner:TComponent);Override;
...
{ Public declarations }
published
...
{ Published declarations }
end;
procedure TDBTreeViewEX.Collapsed(Sender: TObject; Node: TTreeNode);
begin
Node.ImageIndex:=0;
inherited;
end;
procedure TDBTreeViewEx.Expanded(Sender: TObject; Node: TTreeNode);
begin
Node.ImageIndex:=2;
inherited;
end;