ÍøÂç±à³Ì | Õ¾³¤Ö®¼Ò | ÍøÒ³ÖÆ×÷ | ͼÐÎͼÏó | ²Ù×÷ϵͳ | ³åÀ˱¦µä | Èí¼þ½Ìѧ | ÍøÂç°ì¹« | Óʼþϵͳ | ÍøÂ簲ȫ | ÈÏÖ¤¿¼ÊÔ | ϵͳ½ø³Ì
Firefox | IE | Maxthon | ѸÀ× | µç¿ | BitComet | FlashGet | QQ | QQ¿Õ¼ä | Vista | ÊäÈë·¨ | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
µ±Ç°Î»Öà > ÍøÕ¾½¨ÉèѧԺ > ÍøÂç±à³Ì > Delphi
Tag:×¢Èë,´æ´¢¹ý³Ì,·ÖÒ³,°²È«,ÓÅ»¯,xmlhttp,fso,jmail,application,session,·ÀµÁÁ´,stream,ÎÞ×é¼þ,×é¼þ,md5,ÂÒÂë,»º´æ,¼ÓÃÜ,ÑéÖ¤Âë,Ëã·¨,cookies,ubb,ÕýÔò±í´ïʽ,ˮӡ,Ë÷Òý,ÈÕÖ¾,ѹËõ,base64,urlÖØÐ´,ÉÏ´«,¿Ø¼þ,Web.config,JDBC,º¯Êý,ÄÚ´æ,PDF,Ç¨ÒÆ,½á¹¹,ÆÆ½â,±àÒë,ÅäÖÃ,½ø³Ì,·Ö´Ê,IIS,Apache,Tomcat,phpmyadmin,Gzip,´¥·¢Æ÷,socket
ÍøÂç±à³Ì£ºASP½Ì³Ì,ASP.NET½Ì³Ì,PHP½Ì³Ì,JSP½Ì³Ì,C#½Ì³Ì,Êý¾Ý¿â,XML½Ì³Ì,Ajax,Java,Perl,Shell,VB½Ì³Ì,Delphi,C/C++½Ì³Ì,Èí¼þ¹¤³Ì,J2EE/J2ME,ÒÆ¶¯¿ª·¢
±¾ÔÂÎÄÕÂÍÆ¼ö
.ÔÚDELPHI2.0/3.0ÖÐÖ±½Ó²Ù×÷¶Ë¿Ú.
.»ñÈ¡ÆäËû½ø³ÌÖÐListViewµÄÎı¾.
.DelphiÀý³Ì£­Ó¦ÓóÌÐò¼¶ÐÅÏ¢.
.ʵÏÖLucas-Kanade¹âÁ÷¼ÆËãµÄDelp.
.±àÒëÔ­ÀíµÄÒ»¸ö¼òµ¥µÄö¾ÙËã·¨.
.ÔÚDelphi´°¿ÚÖд´½¨IE·ç¸ñµÄ²Ëµ¥.
.DELPHI»ù´¡¿ª·¢¼¼ÇÉ.
.SQLÔÚDelphiÊý¾Ý¿â³ÌÐòÉè¼ÆÓ¦ÓÃdz.
.DelphiÊý¾Ý¿â±à³Ì½Ì³Ì.
.DelphiÃüÁîÐвÎÊý.
.Delphi¿Ø¼þÖÆ×÷¼¼ÇÉ[¶þ].
.Ò»¸öC++³ÌÐòÔ±µÄDelphiѧϰ±Ê¼Ç.
.PowerBuilderµ÷ÓÃDelphiдµÄDllʱ.
.ÐÞÕýXPMenuµÄÁ½¸öBug.
.¹ØÓÚÔÚDelphiÖÐÓ¦ÓÃIinternetPro.
.delphi´úÂë±ê×¼Îĵµ.
.url±àÂëÓë½âÂ빤¾ß¸½´úÂë.
.ÔÚdelphiÖÐÈçºÎÏÞÖÆÊó±êµÄÒÆ¶¯Çø.
.Ô¶³Ì¿ØÖÆÆª£º×¥È¡Ô¶³ÌÆÁĻͼÏñ.
.¿Í»§¶ËÈËÐÔ»¯Éè¼Æ.

Commandģʽ

·¢±íÈÕÆÚ£º2006-2-4


×î½üѧϰģʽÈëÃÔ£¬ ËùÒÔ¾ÍÏëдһƪ¹ØÓÚģʽµÄÎÄÕ£¬ÕâÆªÎÄÕÂÊÇ<<Java Óëģʽ>> £¨ÑÖºê Öø£©ÀïµÄÒ»¸öÀý×Ó£¬ ÎÒ°ÑËü¸Ä³ÉDelphiµÄ.µÚÒ»´Îд¶«Î÷£¬ Óв»×ãÖ®´¦Ï£Íû´ó¼Ò¿ÉÒÔÁ½â.

Õâ¸öÀý×Ó»¹ÊDZȽϺÃÀí½âµÄ£¬ ËùÒÔÖ»¸ø³ö´úÂë.

unit pattern;

interface

uses Dialogs;

type
  TAudioPlayer = class;

  TCommand = class
  public
    procedure execute; virtual; abstract;
  end;

  TPlayCommand = class(TCommand)
  private
    AudioPlayer: TAudioPlayer;
  public
    procedure execute; override;
    procedure Playcommand(AP: TAudioPlayer);
  end;

  TStopCommand = class(TCommand)
  private
    AudioPlayer: TAudioPlayer;
  public
    procedure execute; override;
    procedure StopComman(AP: TAudioPlayer);
  end;

  TRewindCommand = class(TCommand)
  private
    AudioPlayer: TAudioPlayer;
  public
    procedure execute; override;
    procedure RewindCommand(AP: TAudioPlayer);
  end;

  TKeyPad = class
  private
    PlayCommand: TCommand;
    StopCommand: TCommand;
    RewindCommand: TCommand;
  public
    constructor Create(PlayC, StopC, RewindC: TCommand); virtual;
    procedure play();
    procedure stop();
    procedure rewind();
  end;

  TAudioPlayer = class
  public
    procedure play();
    procedure stop();
    procedure rewind();
  end;

  TClient = class
  private
    KeyPad: TKeyPad;
    AudioPlayer: TAudioPlayer;
  public
    constructor Create();
    procedure test();
  end;

implementation

{ TKeyPad }

constructor TKeyPad.Create(PlayC, StopC, RewindC: TCommand);
begin
  PlayCommand := PlayC;
  StopCommand := StopC;
  RewindCommand := RewindC;
end;

procedure TKeyPad.play;
begin
  PlayCommand.execute;
end;

procedure TKeyPad.rewind;
begin
  RewindCommand.execute;
end;

procedure TKeyPad.stop;
begin
  StopCommand.execute;
end;

{ TAudioPlayer }

procedure TAudioPlayer.play;
begin
  ShowMessage('play');
end;

procedure TAudioPlayer.rewind;
begin
  ShowMessage('rewind');
end;

procedure TAudioPlayer.stop;
begin
  ShowMessage('stop');
end;

{ TPlayCommand }

procedure TPlayCommand.execute;
begin
  inherited;
  AudioPlayer.play();
end;

procedure TPlayCommand.Playcommand(AP: TAudioPlayer);
begin
  self.AudioPlayer := AP;
end;

{ TRewindCommand }

procedure TRewindCommand.execute;
begin
  inherited;
  AudioPlayer.Rewind;
end;

procedure TRewindCommand.RewindCommand(AP: TAudioPlayer);
begin
  AudioPlayer := ap;
end;

{ TStopCommand }

procedure TStopCommand.execute;
begin
  inherited;
  AudioPlayer.Stop;
end;

procedure TStopCommand.StopComman(AP: TAudioPlayer);
begin
  AudioPlayer := ap;
end;

{ TClient }

constructor TClient.Create;
begin
  AudioPlayer := TAudioPlayer.Create();
end;

procedure TClient.test;
var
  PlayCommand: TCommand;
  StopCommand: TCommand;
  RewindCommand: TCommand;
begin
  PlayCommand := TPlayCommand.Create;
  StopCommand := TStopCommand.Create;
  RewindCommand := TRewindCommand.Create;
  KeyPad := TKeyPad.Create(PlayCommand, StopCommand, RewindCommand);
  KeyPad.stop;
  KeyPad.play;
  KeyPad.rewind;
  KeyPad.Stop;
end;

end.
 

ÉÏһƪ£º½¨Á¢¡¢¶ÁÈ¡¡¢´æÖüINIÎļþµÄ·½·¨¡¶Èý¡· ÈËÆø:3646
ÏÂһƪ£ºÖ»ÔÊÐí½¨Á¢Ò»´Î×Ó´°ÌåµÄMDI³ÌÐò ÈËÆø:4724
ä¯ÀÀÈ«²¿DelphiµÄÄÚÈÝ Dreamweaver²å¼þÏÂÔØ ÍøÒ³¹ã¸æ´úÂë ×£ÄãÊ¥µ®½Ú¿ìÀÖ 2009ÄêÐÂÄê¿ìÀÖ