delphi 中如何在form1窗口中添加一个方法,并且怎样在类中调用自身的方法呢?

解决方案 »

  1.   


    function  TForm1.IntToBinary(v:Integer):String;
    begin
      while V <> 0 do
      begin
        Result := Inttostr(V mod 2) + Result ;
        V := V div 2;
      end;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin  showMessage(IntToBinary(234) );
    end;当点击一个BUTTON时,返回IntToBinary函数的返回值
      

  2.   

    type
      TForm1 = class(TForm)
        Button2: TButton;
        Edit1: TEdit;
        Button3: TButton;
        Edit2: TEdit;
        Edit3: TEdit;
        procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure Button2Click(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        
      private
        { Private declarations }
      public
        { Public declarations }
      procedure xxx(); //在这里添加 
      end;{$R *.dfm}
    procedure tform1.xxx;//这里写过程
    beginend;