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

📄 uset.pas

📁 这是一个门禁系统的应用程序,用 delphi编写,希望与大家交流.
💻 PAS
字号:
unit uset;

interface

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

type
  TfrmSet = class(TForm)
    gbTopic: TGroupBox;
    edtsTopic: TEdit;
    btnSetTopic: TBitBtn;
    gbBg: TGroupBox;
    btnSegBg: TBitBtn;
    btnReSet: TBitBtn;
    odBg: TOpenDialog;
    gbBirth: TGroupBox;
    btnSetBirth: TBitBtn;
    cbBirth: TCheckBox;
    procedure btnSetTopicClick(Sender: TObject);
    procedure btnSegBgClick(Sender: TObject);
    procedure btnReSetClick(Sender: TObject);
    procedure btnSetBirthClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmSet: TfrmSet;

implementation

uses umain, uglobal, ustainfo;

var
  iFile: tinifile;

{$R *.dfm}

procedure TfrmSet.FormCreate(Sender: TObject);
begin
  edtsTopic.Text := sTopic;
  iFile := TIniFile.Create(sPath + 'perset.ini');
  cbBirth.Checked := iFile.ReadBool('staff', 'sbirth', false) = true;
end;

procedure TfrmSet.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  iFile.Free;
end;

procedure TfrmSet.btnSetTopicClick(Sender: TObject);
begin
  if edtsTopic.Text <> '' then
  begin
    iFile.WriteString('sTopic', 'topic', Trim(edtsTopic.Text));
    MessageBox(self.Handle, '主题设置成功!', '提示', mb_IconInformation + mb_Ok);
    frmPer.Caption := Trim(edtsTopic.Text);
  end
  else
  begin
    MessageBox(self.Handle, '请输入系统主题!', '提示', mb_IconInformation + mb_Ok);
    edtsTopic.SetFocus;
  end;
end;

procedure TfrmSet.btnSegBgClick(Sender: TObject);
var
  fName, fNameo: string;
begin
  if odBg.Execute then
  begin
    fNameo := iFile.ReadString('sysbg', 'bground', 'main.jpg');
    if FileExists(sPath + fNameo) and (fNameo <> 'main.jpg') then
      DeleteFile(sPath + fNameo);
    fName := ExtractFileName(odbg.FileName);
    CopyFile(Pchar(odbg.FileName),  pchar(sPath + 'images\' + fName), false);
    iFile.WriteString('sysbg', 'bground', 'images\' + fName);
    frmPer.imgMain.Picture.LoadFromFile(sPath + 'images\' + fName);
    MessageBox(self.Handle, '背景设置成功!', '提示', mb_IconInformation + mb_Ok);
  end;
end;

procedure TfrmSet.btnReSetClick(Sender: TObject);
var
  fName: string;
begin
  fName := iFile.ReadString('sysbg', 'bground', '');
  if FileExists(sPath + fName) and (fName <> 'main.jpg') then
    DeleteFile(sPath + fName);
  iFile.WriteString('sysbg', 'bground', 'main.jpg');
  frmPer.imgMain.Picture.LoadFromFile(sPath + 'main.jpg');
  MessageBox(self.Handle, '背景复原成功!', '提示', mb_IconInformation + mb_Ok);
end;

procedure TfrmSet.btnSetBirthClick(Sender: TObject);
begin
  if cbBirth.Checked then
  begin
    iFile.WriteBool('staff', 'sbirth', true);
    MessageBox(self.Handle, '生日提醒设置成功!', '提示', mb_IconInformation + mb_Ok);
    bStaffBirth := true;
    if Assigned(frmStaInfo) then
      if not frmStainfo.meoBirth.Visible then frmStainfo.meoBirth.Visible := true;
  end
  else
  begin
    iFile.WriteBool('staff', 'sbirth', false);
    MessageBox(self.Handle, '生日提醒已取消!', '提示', mb_IconInformation + mb_Ok);
    bStaffBirth := false;
    if Assigned(frmStaInfo) then
      if frmStaInfo.meoBirth.Visible then frmStainfo.meoBirth.Visible := false;
  end;
end;

end.

⌨️ 快捷键说明

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