DELPHI如何响应事件
由于项目需要,开始学习DELPHI,并自己编写代码来测试用VC写的DLL,觉得自己又多掌握了一些,不对的地方希望指正,我会好好学习
1、响应键盘事件:
因为KeyPreview默认是 False;我们这里需要响应键盘事件的话,需要将其修改为True;
所以KeyPreview:=True; 这对一些快捷键会有用。
在FormCreate这个函数里修改KeyPreview := True;
在FormKeyDown这个函数里就可以对键盘事件进行操作了,(*^__^*) 嘻嘻
不断更新。。。
相关文档:
1. 产品类
{《HeadFirst设计模式》工厂模式之简单工厂 }
{ 产品类 }
{ 编译工具 :Delphi7.0 }
{ 联系方式 :xshlife@163.com }
unit uProducts;
interface
type
TPizza = class(TObject)
public
procedure Prepare; virt ......
在一个单元中声明的多个类互为友元类
type
TMyClass = class
GUID: string;
Name: string;
bSex: Boolean;
Tel : string;
end;
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedu ......
1.主题与观察者
{《HeadFirst设计模式》之观察者模式 }
{ 主题与观察者 }
{ 编译工具 :Delphi7.0 }
{ 联系方式 :xshlife@163.com }
unit uWeatherReport;
interface
uses
Classes, SysUtils;
type
TObserver = class; { Forward声明,创建两个相 ......
1. 复杂的子系统
unit uSubObject;
interface
type
{ TAmplifier与TTuner,TCDPlayer,TDVDPlayer相互依赖。 }
{ 在TTuner等的简单实现时用不到对TAmplifier的引用, }
{ 但现实生活中就应该让TAmplifier提供服务,所以这里保留了。 }
{ TProjector对T ......
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; ......