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

📄 unit1.pas

📁 本光盘是《Delphi 7应用教程》一书的配套光盘
💻 PAS
字号:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  if (Edit1.Text='123abc') then //Edit1.Text='123abc'为关系表达式
    begin                  //当关系表达式值为真时执行下面的复合语句
      Edit2.Text:='欢迎使用本系统';    //文本内容为欢迎使用本系统
      Edit2.Font.Name:='隶书';               //文本字体为隶书
      Edit2.Font.Color:=clBlue;              //字体颜色为蓝色
      Edit2.Font.Size:=18;                   //字号为18号
    end
  else                              //else之前没有分号
    begin                           //当密码错执行下面的复合语句
      Edit2.Text:='警告,密码错!'; // 文本内容为警告,密码错!
      Edit2.Font.Name:='楷体';      //字体变为楷体
      Edit2.Font.Size:=18;
      Edit2.Font.Color:=clRed;      //字体颜色为红色
    end;
end;

end.

⌨️ 快捷键说明

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