unitdlsw.pas

来自「初中成绩录入系统网络版(firebird) firebird下的网络编程」· PAS 代码 · 共 66 行

PAS
66
字号
unit UnitDLSW;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TfmDLSW = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

uses unitAchieve;

{$R *.dfm}

procedure TfmDLSW.BitBtn1Click(Sender: TObject);
var
  a,b,c,d:Integer;
  achieve:Tachieve;
begin
  TryStrtoInt(edit1.Text,a);
  TryStrtoInt(edit2.Text,b);
  TryStrtoInt(edit3.Text,c);
  TryStrToInt(edit4.Text,d);
  if a+b+c+d<>10 then
  begin
    Application.MessageBox('各比例总和不等于10','错误',MB_OK or MB_ICONERROR);
    exit;
  end;
  if (a=0) or (b=0) or (c=0) or (d=0) then
  begin
    Application.MessageBox('各比例值均不能为0','错误',MB_OK or MB_ICONERROR);
    exit;
  end;
  achieve:=Tachieve.Create;
  achieve.CalculateDLSW(a,b,c,d);
  Achieve.Free;
  Application.MessageBox('计算完毕!','提示',MB_OK or MB_ICONINFORMATION);
//  self.ModalResult:=mrOK;
end;

procedure TfmDLSW.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9',char(VK_Delete),char(VK_BACK)]) then
    key:=#0;
end;

end.

⌨️ 快捷键说明

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