⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webform1.pas.~47~

📁 《Delphi程序员成长攻略》-蒙祖强龚涛的源代码
💻 ~47~
字号:

unit WebForm1;

interface

uses
  System.Collections, System.ComponentModel,SysUtils,
  System.Data, System.Drawing, System.Web, System.Web.SessionState,
  System.Web.UI, System.Web.UI.WebControls, System.Web.UI.HtmlControls;

type
  TWebForm1 = class(System.Web.UI.Page)
  {$REGION 'Designer Managed Code'}
  strict private
    procedure InitializeComponent;
    procedure Button1_Click(sender: System.Object; e: System.EventArgs);
    procedure Button4_Click(sender: System.Object; e: System.EventArgs);
  {$ENDREGION}
  strict private
    procedure Page_Load(sender: System.Object; e: System.EventArgs);
  strict protected
    Label1: System.Web.UI.WebControls.Label;
    Label2: System.Web.UI.WebControls.Label;
    Label3: System.Web.UI.WebControls.Label;
    TextBox1: System.Web.UI.WebControls.TextBox;
    TextBox2: System.Web.UI.WebControls.TextBox;
    TextBox3: System.Web.UI.WebControls.TextBox;
    Label4: System.Web.UI.WebControls.Label;
    Label5: System.Web.UI.WebControls.Label;
    Button1: System.Web.UI.WebControls.Button;
    Label6: System.Web.UI.WebControls.Label;
    TextBox4: System.Web.UI.WebControls.TextBox;
    Label7: System.Web.UI.WebControls.Label;

  
    Button2: System.Web.UI.WebControls.Button;
    procedure OnInit(e: EventArgs); override;
  private
    { Private Declarations }
  public
    { Public Declarations }
  end;

implementation

uses localhost1.WebService1;

{$REGION 'Designer Managed Code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure TWebForm1.InitializeComponent;
begin
  Include(Self.Button1.Click, Self.Button1_Click);
  Include(Self.Button2.Click, Self.Button4_Click);
  Include(Self.Load, Self.Page_Load);
end;
{$ENDREGION}

procedure TWebForm1.Page_Load(sender: System.Object; e: System.EventArgs);
begin
  // TODO: Put user code to initialize the page here
end;

procedure TWebForm1.OnInit(e: EventArgs);
begin
  //
  // Required for Designer support
  //
  InitializeComponent;
  inherited OnInit(e);
end;

procedure TWebForm1.Button4_Click(sender: System.Object; e: System.EventArgs);
var CircleSer:TWebService1;
    result:double;
begin
    CircleSer := TWebService1.Create;
    //调用Web服务,求圆的面积
    result := CircleSer.Circle(StrToFloat(TextBox4.Text));
    label7.Text:='圆的面积:S = '+FloatToStr(result);

    //(StrToFloat(TextBox1.Text),StrToFloat(TextBox2.Text),StrToFloat(TextBox3.Text));
    

end;

procedure TWebForm1.Button1_Click(sender: System.Object; e: System.EventArgs);
var EquationSer:TWebService1;
    result:double;
begin
    EquationSer := TWebService1.Create;
    //调用Web服务,求方程的第一个根x1
    result := EquationSer.Equation_x1(StrToFloat(TextBox1.Text),StrToFloat(TextBox2.Text),StrToFloat(TextBox3.Text));
    label4.Text:='方程的第一个根:x1= '+FloatToStr(result);
    //调用Web服务,求方程的第二个根x2
    result := EquationSer.Equation_x2(StrToFloat(TextBox1.Text),StrToFloat(TextBox2.Text),StrToFloat(TextBox3.Text));
    label5.Text:='方程的第二个根:x2= '+FloatToStr(result);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -