unit1.~pas
来自「这有很多Delphi应用的例子」· ~PAS 代码 · 共 47 行
~PAS
47 行
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Number : Integer;
begin
Number := StrToInt(Edit1.Text);
case Number of
1,3,5,7,9: Label1.Caption := '奇数';
0,2,4,6,8: Label1.Caption := '偶数';
10..100:
begin
Label1.Caption := '在10到100之间';
Form1.Color := clBlue;
end;
else
Label1.Caption := '大于100或为负数';
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?