⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utreelistform.pas

📁 观察者模式delphi实例实现,同时注意软件的设计
💻 PAS
字号:
unit uTreeListForm;

interface

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, ComCtrls, uInterface;

type
    TTreeListForm = class(TForm, IPhotoNotify)
        TreeView: TTreeView;
    private
        fPhotoMgr :IPhotoMgr;
    private
        //实现IPhotoNotify接口
        function SelPhoto(const photoID:Integer):Boolean;        
        function NewPhoto(const photoID:Integer):Boolean;
        function DelPhoto(const photoID:Integer):Boolean;
        function Refresh():Boolean;
        function PropChange(const photoID:Integer):Boolean;
    public
        procedure SetPhotoMgr(photoMgr:IPhotoMgr);
    end;

var
    TreeListForm: TTreeListForm;

implementation

{$R *.dfm}

{ TTreeListForm }

{//////////////////////////////////////////////////////////////////////////////}
function TTreeListForm.DelPhoto(const photoID: Integer): Boolean;
begin
    Result := True;

end;

{------------------------------------------------------------------------------}
function TTreeListForm.NewPhoto(const photoID: Integer): Boolean;
begin
    Result := True;
    ShowMessage('New Photo' + IntToStr(photoID));
end;

{------------------------------------------------------------------------------}
function TTreeListForm.PropChange(const photoID: Integer): Boolean;
begin
    Result := True;
end;

{------------------------------------------------------------------------------}
function TTreeListForm.Refresh: Boolean;
begin
    Result := True;
end;

{------------------------------------------------------------------------------}
function TTreeListForm.SelPhoto(const photoID: Integer): Boolean;
begin
    Result := True;
end;

{//////////////////////////////////////////////////////////////////////////////}
procedure TTreeListForm.SetPhotoMgr(photoMgr: IPhotoMgr);
begin
    fPhotoMgr := photoMgr;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -