过程和函数应在什么位置定义,如何调用?

解决方案 »

  1.   

    你如果不懂的话,你蹴去看自带的系统单元文件,你看是怎么定义怎么调用实现的。
    例如按住 Ctrl键,鼠标点击你uses下的任意单元文件即可进入,你看看
      

  2.   

    .
      .
      .
      private
        { Private declarations }
         procedure pp1(a: string);//只能在本窗体用的过程
         function  ff1(b: string): string;//只能在本窗体用的函数
      public
        { Public declarations }
         procedure pp2(a: string);//只能在其它窗体也能用的过程
         function  ff2(b: string): string;//只能在其它窗体也能用的函数
      end;var
      Form1: TForm1;
         function ff3(n: integer): integer;//跟在public定义一样implementation{$R *.dfm}function ff3(n: integer): integer;
    begin
       //你要处理的代码
    end;procedure TForm1.pp1(a: string);
    begin
       //你要处理的代码
    end;procedure TForm1.pp2(a: string);
    begin
       //你要处理的代码
    end;function TForm1.ff1(b: string):string;
    begin
       //你要处理的代码
    end;function TForm1.ff2(b: string):string;
    begin
       //你要处理的代码
    end;
    end.