S Solid_Snake Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #1 我想初始化定义全局(至少是模块间)的TRect,但是总是提示语法出错,到底应该如何声明和定义呢? 例如TPoint这样的数据类型有应该如何初始化定义呢?
Z zjan521 Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #2 1.TPoint pt = (x:100,y:100);//我记不太清了,中间也可能是;分号 2.TRect r = Rect(0, 0, 100, 100);//利用一个函数返回值 3.利用常量 其实是 综合了1和2 const TPoint csPoint = (x:100, y:100); TPoint pt = csPoint; (这两天在领略C#,Delphi也有段没摸了,好像变量声明方式不太对,不过后边是那样的没错,或者你也可以详细查找Delphi源代码或帮助)
1.TPoint pt = (x:100,y:100);//我记不太清了,中间也可能是;分号 2.TRect r = Rect(0, 0, 100, 100);//利用一个函数返回值 3.利用常量 其实是 综合了1和2 const TPoint csPoint = (x:100, y:100); TPoint pt = csPoint; (这两天在领略C#,Delphi也有段没摸了,好像变量声明方式不太对,不过后边是那样的没错,或者你也可以详细查找Delphi源代码或帮助)
T TYZhang Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #4 Const R:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P:TPoint = (x:100 y:100); var R1:TRect; P1:TPoint; begin R1:=Rect(1,1,2,2); P1:=Point(200,200); end;
Const R:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P:TPoint = (x:100 y:100); var R1:TRect; P1:TPoint; begin R1:=Rect(1,1,2,2); P1:=Point(200,200); end;
S Solid_Snake Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #5 to TYZhang:上面的语法应该如何内嵌在单元文件中。。。。。真是不好意思,能不能给我一个内嵌的演示,我这样定义对吗: type TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject Button: TMouseButton; Shift: TShiftState X, Y: Integer); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Const R:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P:TPoint = (x:100 y:100); var R1:TRect; P1:TPoint; implementation {$R *.dfm} 真是麻烦了您了。
to TYZhang:上面的语法应该如何内嵌在单元文件中。。。。。真是不好意思,能不能给我一个内嵌的演示,我这样定义对吗: type TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject Button: TMouseButton; Shift: TShiftState X, Y: Integer); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Const R:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P:TPoint = (x:100 y:100); var R1:TRect; P1:TPoint; implementation {$R *.dfm} 真是麻烦了您了。
S Siva Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #6 procedure tform1.create(); begin R1:=Rect(1,1,2,2); P1:=Point(200,200); end;
S Solid_Snake Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #7 to Siva,我想定义全局变量。。。。。
T TYZhang Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-23 #8 //静态 Const R:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P:TPoint = (x:100 y:100); type TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject Button: TMouseButton; Shift: TShiftState X, Y: Integer); private { Private declarations } public { Public declarations } end; var Form1: TForm1; //动态 R1:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P1:TPoint = (x:100 y:100); implementation {$R *.dfm} //另:我没有qq,msn:zymnj@hotmail.com
//静态 Const R:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P:TPoint = (x:100 y:100); type TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject Button: TMouseButton; Shift: TShiftState X, Y: Integer); private { Private declarations } public { Public declarations } end; var Form1: TForm1; //动态 R1:TRect = (Left: 11 Top: 2 Right: 2 Bottom: 2); P1:TPoint = (x:100 y:100); implementation {$R *.dfm} //另:我没有qq,msn:zymnj@hotmail.com