设为首页 加入收藏

TOP

Delphi7.0常用函数-属性-事件(六)
2017-10-10 12:03:46 】 浏览:3359
Tags:Delphi7.0 常用 函数 属性 事件
ons must be coded
procedure MyProc;
begin
// ... code of procedure MyProc
end;
initialization
// optional initialization part
finalization
// optional clean-up code
end.

单元用作命名空间

Delphi 应用程序源代码文件可分成两类,它们是一个或多个单元文件及一个程序文件,单元文件可以看成是次一级的文件,它被应用程序的主体——程序文件——引用。
program Project1;

uses
forms,
Unit1 in Unit1.PAS?{form1Dateform};

begin
Application.Initialize;
Application.Createform (Tform1, form1);
Application.Run;
end.


面向对象
type
TData = class
A:Integer;
B:Char;
function F(V:Integer):Boolean;
var C:Integer;
begin
A :=1;
C :=A;
end;
procedure P(V:Char);
begin
B:='b';
end;
end.

public
private
protected

self变量
publish

继承
type
MyClass = class(BaseClass);
多继承
type
MyClass = class();

构造器
constructor 代替procedure;自动分配内存
对象方法重载 同函数

多态
type
BaseClass = class
public
function F:String;virtual;
end;

type
MyClass = class(BaseClass)
public
function F:String;override;
end;

类型兼容性
向上兼容
之类兼容父类

类型信息
if MyClass is BaseClass then

继承
inherited; 使用父辈被继承的方法

类引用
MyClassClass = class of MyClass;

Create()
Free()
type里面类声明
implementation
实现


initialization //初始化段
Init();
finalization //反初始化段
UnInit();

constructor Create();
destructor Destroy();

procedure fly(); virtual; abstract;抽象

接口 interface
type
Icanfly = interface
['{10000000-0000-0000-0000-0000000000}']
function Fly:String;
end;

type
TAirplane = class(TomerfaceObject,IcanFly)
function Fly:String virtual;
end;

Flyer1 :=TAirplance.Create as Icanfly;

QueryInterface

 

异常 错误处理
raise Exceptoion.Create('a error');

try
A();
except
...
finally
...
end;

继承异常类 p54


VCL
TObject
TPresistent
TComponent
TControl可视化控件
Windowsed Controls 基于window的控件(TWinControl)
Nonwindowsed Controls( TGraphicsControl)
Nonvisual Components非可视控件

 

可视化组件
Window-based controls
有GDI句柄,Windows管理,拥有Windows对象的属性
Graphical controls
无GDI句柄,自行绘图管理,如大量的Laber(比较Static控件) speedbutton,节省GDI资源,但响应事件麻烦。

novisiual compoenets 一些管理组件


可融入编辑环境
published private/public
procedure p:string;

property month:Integer
read FMonth write SetMonth;
读写为变量或者过程。
read GetMonth write SetMonth;

function GetMonth:Integer;读
procedure SetMonth(const value:Integer);写

只读属性的话就不带read 或 write

对象拷贝
Assigned()

事件
private
FonClick : TNotifyEvent;
……
published:
property onClick : TNotifyEvent Read FonClick Write FonClick;

 

首页 上一页 3 4 5 6 下一页 尾页 6/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇延时程序 下一篇[上架] iOS 上架更新版本号建议

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目