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

📄 upanelform.pas

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

interface

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

type
    TPanelForm = class(TForm, IPhotoNotify)
    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
    PanelForm: TPanelForm;

implementation

{$R *.dfm}

{ TPanelForm }

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

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

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

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

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

{------------------------------------------------------------------------------}
procedure TPanelForm.SetPhotoMgr(photoMgr: IPhotoMgr);
begin
    fPhotoMgr := photoMgr;
end;

end.

⌨️ 快捷键说明

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