showinterface.pas

来自「基于DELPHI的图片浏览系统设计与实现」· PAS 代码 · 共 74 行

PAS
74
字号
unit ShowInterface;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
IShowPic = interface
   ['{B8492167-329A-4794-BDC9-14EDF2921DF6}']
    function GetInstance(const f: string): TPersistent;
end;

type
IFactory = interface
   ['{F902C251-4139-4502-BAA3-E54F25819A6B}']
   function CreateShowPic: IShowPic;
end;

TShowGif = class(TInterfacedObject, IShowPic)
   function GetInstance(const f: string): TPersistent;
end;

TShowGifFactory = class(TInterfacedObject, IFactory)
   function CreateShowPic: IShowPic;
end;
{
type
TShowJpeg = class(TInterfacedObject, IShowPic)
   function GetInstance: TObject;
end;

type
TShowBmp = class(TInterfacedObject, IShowPic)
   function GetInstance: TObject;
end;

type
TShowPng = class(TInterfacedObject, IShowPic)
   function GetInstance: TObject;
end;
 }
type
TShowCommom = class(TInterfacedObject, IShowPic)
   function GetInstance(const f: string): TPersistent;
end;

implementation

uses GIFImage;

{ TShowCommom }

function TShowCommom.GetInstance(const f: string): TPersistent;
begin
   //
end;

function TShowGif.GetInstance(const f: string): TPersistent;
var
a:Tgifimage;
begin
  a:= Tgifimage.Create;
  a.LoadFromFile(f);
  Result := a;
end;

function TShowGifFactory.CreateShowPic: IShowPic;
begin
   Result := TShowGif.Create;
end;

end.

⌨️ 快捷键说明

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