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

📄 unit1.pas

📁 Delphi basic program. Basic programing guide for delphi language. Several samples are giving.
💻 PAS
字号:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    GroupBox2: TGroupBox;
    CheckBox3: TCheckBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    ComboBox1: TComboBox;
    Button1: TButton;
    BitBtn1: TBitBtn;
    Label3: TLabel;
    Memo1: TMemo;
    Label4: TLabel;
    LabeledEdit1: TLabeledEdit;
    ComboBox2: TComboBox;
    procedure BitBtn1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Flag: Boolean;  // 标志员工资料内容是否修改

implementation

{$R *.DFM}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
     if Flag then
     begin
          if MessageDlg('员工资料已经修改,是否更新?',
             mtInformation,[mbYes, mbNo],0) = mrYes then
          begin
              // 更新员工资料内容
              Button1Click(BitBtn1);
              ShowMessage('你选择了更新员工资料!');
          end
     end;
     // 退出应用程序
     Application.Terminate;
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
     // 资料更改,让“显示资料”按钮有效
     Button1.Enabled := True;
     // 标志属性内容已经修改
     Flag := True;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
     // 清空Memo1组件,便于重新生成员工资料内容
     Memo1.Clear;

     // 如果已经输入姓名,则添加到简历中
     if Edit1.Text <> '' then
        Memo1.Text:= '姓名:'+Edit1.Text;

     // 如果在组合框中已选择职位,则添加到资料中
     if ComboBox1.Text <> ''  then
        Memo1.Text:= Memo1.Text+#13#10'职位:'+ComboBox1.Text;

     // 将性别添加到资料中
     if RadioButton1.Checked = True then
        Memo1.Text := Memo1.Text+#13#10'性别:男'
     else
        Memo1.Text := Memo1.Text+#13#10'性别:女';

       // 将语种添加到资料中
     if CheckBox1.Checked = True then
        Memo1.Text := Memo1.Text+#13#10'语种为汉语';
     if CheckBox2.Checked = True then
        Memo1.Text := Memo1.Text+#13#10'语种为英语';
     if CheckBox3.Checked = True then
        Memo1.Text := Memo1.Text+#13#10'语种为法语';

     // 标志资料内容已经刷新
     Flag := False;
     // 将“刷新”按钮失效     
     Button1.Enabled:=False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
     // 初始化时
     Button1.Enabled:=False;
     // 标志属性内容没有修改
     Flag:=False;
end;

end.

⌨️ 快捷键说明

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