delphi如何建立自定义类?
解决方案 »
- D7RegClean.exe
- delphi如何使用SafeArray?
- 现在没有经验真的不行吗?郁闷散分~!
- 求兼职
- 请教问题~!
- 怎么用SQL语句删除一条记录?
- delphi 调用oracle的exp 急急急
- 有Modem的DFW看过来,我需要关于Modem的相关注册信息
- 请帮个忙
- 我用ADO连接SQL,并且在服务器上面的数据库里面建立了一个表,可是客户端提示出“adoquery1:commandtext does not return a result set” 是怎么回事呀?
- 50分请教:Privileged instruction问题?
- 向大家提一个很简单的问题:如何在字符串中的提取子字符串??
Tmyclass=class
private
fx:integer;
....
protected
...
public
procedure setx;
function getx;
....
end;
可以在单独pas文件中,如果和窗体文件混在一块的话需要写在type之后,要和窗体本身的定义分开
楼主可以看看DELPHI面向对象编程思想
unit Tst_XML2U;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBClient, StdCtrls;//============自定义类==========
type
TMyClass=class
字段:integer; //不支持中文,为了你看得明白才用中文
private
私有字段:string;
procedure 私有过程(v:string);
function 私有函数(a,b,c:integer):boolean;
public
......
end;//===========底下是IDE自动生成的============
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
ClientDataSet1: TClientDataSet;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
或者你建立一个新的unit,