Delphi Éè¼ÆÄ£Ê½£º¡¶HeadFirstÉè¼ÆÄ£Ê½¡·Delphi7´úÂë
1. ÃüÁîµÄ½ÓÊÜÕß
unit uReceiveObject;
interface
type
TLight = class(TObject)
public
procedure Open;
procedure Off;
end;
TGarageDoor = class(TObject)
public
procedure Up;
procedure Down;
procedure Stop;
procedure LightOn;
procedure LightOff;
end;
implementation
{ TLight }
procedure TLight.Off;
begin
Writeln('');
end;
procedure TLight.Open;
begin
Writeln('Light is On.');
end;
{ TGarageDoor }
procedure TGarageDoor.Down;
begin
Writeln('');
end;
procedure TGarageDoor.LightOff;
begin
Writeln('');
end;
procedure TGarageDoor.LightOn;
begin
Writeln('');
end;
procedure TGarageDoor.Stop;
begin
Writeln('');
end;
procedure TGarageDoor.Up;
begin
Writeln('GarageDoor is Open.');
end;
end.
2.ÃüÁî¶ÔÏó
unit uCommandObject;
interface
uses
uReceiveObject;
type
TCommand = class(TObject)
public
procedure Execute; virtual; abstract;
end;
TLightOnCommand = class(TCommand)
private
FLight: TLight;
public
constructor Create(aLight: TLight);
procedure Execute; override;
end;
TGarageDoorOpenCommand = class(Tcommand)
private
FGarageDoor: TGarageDoor;
public
constructor Create(aGarageDoor: TGarageDoor);
procedure Execute; override;
end;
implementation
{ TLightOnCommand }
constructor TLightOnCommand.Create(aLight: TLight);
begin
FLight := aLight;
end;
procedure TLightOnCommand.Execute;
begin
FLight.Open;
end;
{ TGarageDoorOpenCommand }
constructor TGarageDoorOpenCommand.Create(aGarageDoor: TGarageDoor);
begin
FGarageDoor := aGarageDoor;
end;
procedure TGarageDoorOpenCommand.Execute;
begin
FGarageDoor.Up;
end;
end.
3.ÃüÁîµÄÇëÇóÕß¼´·¢³öÕß
unit uSimpleRemoteControl;
interface
uses
uCommandObject;
type
TSimpleRemoteControl = class(TObject)
private
FSlot: TCommand;
public
procedure SetCommand(aCommand: TCommand);
procedure ButtonWasPressed;
end;
implementation
Ïà¹ØÎĵµ£º
Delphi2010¼¯³ÉÁËfastMM£¬Õâ»Ø´ó¼Òµ÷ÊÔ³ÌÐòÊǵÄʱºò¿ÉÒÔ·½±ãµØ¼ì²éÄÚ´æÐ¹Â¶ÁË¡£
ʹÓ÷½·¨ÈçÏ£º
ÔÚprojectÖУ¬Ìí¼ÓÒ»ÐÐ ReportMemoryLeaksOnShutdown := DebugHook<>0;
DebugHook<>0 Ä¿µÄÊDZ£Ö¤µ¥¶ÀÔËÐÐexeÎļþ²»»áµ¯³öÄÚ´æÐ¹Â¶¿ò£¬Ô´Âë¿ÉÒÔ²»ÓÃ×¢Ê͵ô´ËÐÐ
program Project1;
uses
Forms,
......
±¾ÎĵÄÏßÐÔÁÁ¶È/¶Ô±È¶Èµ÷Õû·½·¨ÊÇÔÚ¡¶¸Ä½øµÄͼÏñÏßÐÔÁÁ¶Èµ÷Õû·½·¨¡·Ò»ÎÄÖÐÏßÐÔÁÁ¶Èµ÷Õû·½·¨Óë¡¶DelphiͼÏñ´¦Àí -- PhotoshopͼÏñÁÁ¶È/¶Ô±È¶Èµ÷Õû¡·ÖеĶԱȶȵ÷Õû·½·¨»ù´¡ÉÏÐγɵ쬯äÔÀíºÍÌØµã¿É²Î¼ûÕâ2ƪÎÄÕ£º
¹ý³Ì¶¨Ò壺
// ÏßÐÔµ÷ÕûÁÁ¶È£¬ValueÁÁ¶ÈÖµ
procedure ImageL ......
µ±È»Óû§ÒªÏëͨ¹ýÊý¾Ýä¯ÀÀ²¿¼þ±à¼ÐÞ¸ÄÊý¾Ý¿â±íÖеļǼ×Ö¶Îʱ£¬»¹ÒªÊܵ½ÆäËüÒòËØµÄÖÆÔ¼¡£³ýÁËÊý¾Ýä¯ÀÀ²¿¼þ±¾ÉíµÄReadOnlyÊôÐÔÉèÖÃΪFalseÍ⣬»¹ÒªÉèÖÃÆäÏàÓ¦µÄ×ֶβ¿¼þºÍÊý¾Ý¼¯²¿¼þµÄCanModifyÊôÐÔTrueÐÔ£»ÉèÖÃTDataSource²¿¼þµÄAutoEditÊôÐÔΪTrue£¬Èç¹ûÊý¾Ý¿â±íÊÇSQLÊý¾Ý¿â·þÎñÆ÷ÖеÄÊý¾ ......
Delphi 2010Õýʽ°æÏÂÔØ(RAD Studio 2010ÏÂÔØ)
ÔÚ8ÔÂ26ÈÕÕýʽ·¢²¼ÁËRAD Studio 2010£¬¾ÍÊÇÎÒÃÇËùνµÄDelphi 2010¡£RAD Studio 2010°üº¬Delphi¡¢C++ BuilderºÍDelphi PrismµÈ¡£ RAD Studio 2010 µÄй¦ÄÜÖ÷ÒªÔÚÓÚ£ºÔöÇ¿µÄ IDEºÍ¿ÉÊÓ»¯×é¼þ¿â (VCL) ¿ò¼ÜºÍ»ù´¡µÄ±àÒëÆ÷ÒÔ¼°ÆäËû¸÷Ï¾ß£¬ÕâʹµÃÄã¹¹½¨ÄÇЩ¿çÔ½ËùÓеÄÊý¾ÝÔ´ºÍ ......
ÈÝÆ÷µÄÖ÷ÒªÖ°ÔðÓÐÁ½¸ö£º´æ·ÅÔªËØºÍä¯ÀÀÔªËØ¡£¸ù¾Ýµ¥Ò»Ö°ÔðÔÔò£¨SRP£©Òª½«¶þÕß·Ö¿ª£¬ÓÚÊǽ«ä¯ÀÀ¹¦ÄÜ´ò°ü·â×°¾ÍÓÐÁ˵ü´úÆ÷¡£
Óõü´úÆ÷·â×°¶Ô¶¯Ì¬Êý×éµÄ±éÀú£º
1.ÈÝÆ÷ÖеÄÔªËØÀà
{¡¶HeadFirstÉè¼ÆÄ£Ê½¡·Ö®µü´úÆ÷ģʽ }
{ ÈÝÆ÷ÖеÄÔªËØÀà ......