问:在Delphi中要自定义一个函数,该当如何?
  
  在BCB中只要在ClassExplorer列表中,在TForm1中点右键,New Method...,然后输入对应的参数即可;
  本人刚接触Delphi,不熟,在Delphi不能依此法;那么在Delphi中应当如何呢?   

解决方案 »

  1.   

    function abc: Integer;
    begin
      result := 0;
    end;
      

  2.   

    不是问这个,是问在IDE中如何操作?如何让Delphi自动建立函数空壳,这样,只要直接添加代码
    就行了
      

  3.   

    在exploring界面中(就是代码右边的那个框框),右键TForm1,然后new 输入procedure abc;
    DELPHI就自动给你生成下面的代码
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        procedure bb;
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.bb;
    beginend;procedure TForm1.FormCreate(Sender: TObject);
    beginend;end.
    当然,也可以直接在代码中,写函数或者过程的声明,然后用CTRL+SHIFT+C来自动生成,你自己填写代码,就可以了。
      

  4.   

    按快捷键:Ctrl-J ,会出现一个对话框,里面一大堆,自己看着办