本文介绍了我该如何调用此程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好, 我正在尝试将一个简单的方法转换为带参数的过程,我需要帮助调用语句,因为它在我尝试时会出错编译。 代码如下: 单位Ass13; 界面 使用 Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System .Classes,Vcl.Graphics, Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.Samples.Spin, Vcl.Buttons; 类型 TfrmFee = class(TForm) btnLoss:TButton; sedCycle:TSpinEdit; sedRun:TSpinEdit; gpbLossResults:TGroupBox; lblFee:TLabel; Label1: TLabel; Label2:TLabel; BitBtn1:TBitBtn; 程序btnLossClick(发件人:TObject); 私人 程序GramsOff(HourRun,HourCycle : 整数; var GramOff:String); public {公共声明} 结束; var frmFee:TfrmFee; 实施 { $ R * .dfm} 程序TfrmFee.GramsOff(HourRun,HourCycle:Integer; var GramOff:String); Var TotalCal,GramsLost:整数; 开始 HourRun:=(sedRun.Value * 475); HourCycle: =(sedCycle.Value * 200); TotalCal:=(HourRun + HourCycle); GramsLost:=(TotalCal * 10 DIV 77); GramOff:='减肥:'+ IntToStr(GramsLost)+'克'; 结束; 程序TfrmFee。 btnLossClick(发件人:TObject); var GramsOff:string; begin GramsOff(HourRun,HourCycle :Integer; GramOff:String); lblResults.Caption:= GramOff; en d; 结束。 工作简单方法我是试图转换为程序/功能: 程序TfrmBurningCalories.btnLossClick(发件人:TObject); var TotalCal,GramsLost:Integer;开始 TotalCal:=(sedCycle.Value * 200)+(sedRun.Value * 475); Gramslost:= TotalCal * 10 DIV 77; lblLoss.Caption:='减肥:'+ IntToStr(GramsLost)+'克'; 结束; Hello,I am trying to convert a simple method to a procedure with parameters, I need help with the calling statement as it is giving errors when i try to compile.Code below:unit Ass13;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Samples.Spin, Vcl.Buttons;type TfrmFee = class(TForm) btnLoss: TButton; sedCycle: TSpinEdit; sedRun: TSpinEdit; gpbLossResults: TGroupBox; lblFee: TLabel; Label1: TLabel; Label2: TLabel; BitBtn1: TBitBtn; procedure btnLossClick(Sender: TObject); privateprocedure GramsOff(HourRun, HourCycle : Integer; var GramOff : String); public { Public declarations } end;var frmFee: TfrmFee;implementation{$R *.dfm}procedure TfrmFee.GramsOff(HourRun, HourCycle : Integer; var GramOff : String);Var TotalCal, GramsLost : Integer;Begin HourRun := (sedRun.Value * 475); HourCycle := (sedCycle.Value * 200); TotalCal := (HourRun + HourCycle); GramsLost := (TotalCal * 10 DIV 77); GramOff := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';end;procedure TfrmFee.btnLossClick(Sender: TObject);var GramsOff : string;begin GramsOff (HourRun, HourCycle: Integer; GramOff : String); lblResults.Caption := GramOff;end;end.Working simple Method that I am trying to convert to a procedure/ function:procedure TfrmBurningCalories.btnLossClick(Sender: TObject); var TotalCal, GramsLost : Integer; begin TotalCal := (sedCycle.Value * 200) + (sedRun.Value * 475); Gramslost := TotalCal * 10 DIV 77; lblLoss.Caption := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';end;推荐答案 R * .dfm} 程序TfrmFee.GramsOff(HourRun,HourCycle:Integer; var GramOff:String); Var TotalCal,GramsLost:整数; 开始 HourRun:=(sedRun.Value * 475); HourCycle:= (sedCycle.Value * 200); TotalCal:=(HourRun + HourCycle); GramsLost:=(TotalCal * 10 DIV 77); GramOff:='减肥:'+ IntToStr(GramsLost)+'克'; 结束; 程序TfrmFee.btnLossClick (发件人:TObject); var GramsOff:string; begin GramsOff(HourRun,HourCycle:整数; GramOff:Str ing); lblResults.Caption:= GramOff; 结束; 结束。 工作简单我试图转换为程序/功能的方法: 程序TfrmBurningCalories.btnLossClick(发件人:TObject); var TotalCal,GramsLost:Integer;开始 TotalCal:=(sedCycle.Value * 200)+(sedRun.Value * 475); Gramslost:= TotalCal * 10 DIV 77; lblLoss.Caption:='减肥:'+ IntToStr(GramsLost)+'克'; 结束; R *.dfm}procedure TfrmFee.GramsOff(HourRun, HourCycle : Integer; var GramOff : String);Var TotalCal, GramsLost : Integer;Begin HourRun := (sedRun.Value * 475); HourCycle := (sedCycle.Value * 200); TotalCal := (HourRun + HourCycle); GramsLost := (TotalCal * 10 DIV 77); GramOff := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';end;procedure TfrmFee.btnLossClick(Sender: TObject);var GramsOff : string;begin GramsOff (HourRun, HourCycle: Integer; GramOff : String); lblResults.Caption := GramOff;end;end.Working simple Method that I am trying to convert to a procedure/ function:procedure TfrmBurningCalories.btnLossClick(Sender: TObject); var TotalCal, GramsLost : Integer; begin TotalCal := (sedCycle.Value * 200) + (sedRun.Value * 475); Gramslost := TotalCal * 10 DIV 77; lblLoss.Caption := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';end; 这篇关于我该如何调用此程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-23 13:33