📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
X1: TEdit;
Button1: TButton;
Label2: TLabel;
Edit5: TEdit;
GroupBox2: TGroupBox;
Label3: TLabel;
x: TEdit;
Label4: TLabel;
a1: TEdit;
Label5: TLabel;
b1: TEdit;
Label6: TLabel;
Label7: TLabel;
y: TLabel;
Button2: TButton;
Label9: TLabel;
X2: TEdit;
Y1: TEdit;
Y2: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
a,b:double;
begin
a:= (strtofloat(y2.Text)-strtofloat(y1.Text))/(strtofloat(x2.Text)-strtofloat(x1.Text));
b:= strtofloat(y1.Text)-a*strtofloat(x1.Text);
edit5.Text := 'y='+floattostr(a)+'x+'+floattostr(b);
a1.Text :=floattostr(a);
b1.Text :=floattostr(b);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
y.caption :=floattostr(strtofloat(a1.text)*strtofloat(x.Text)+strtofloat(b1.text));
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -