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

📄 usetschool.pas

📁 Delphi学籍管理程序,以Delphi7.0为前台开发工具
💻 PAS
字号:
unit uSetSchool;

interface

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

type
  TdlgSchool = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Bevel1: TBevel;
    labCaption: TLabel;
    leName: TLabeledEdit;
    leAddress: TLabeledEdit;
    leRector: TLabeledEdit;
    leTel: TLabeledEdit;
    cbHasJunior: TCheckBox;
    cbHasElementary: TCheckBox;
    Label1: TLabel;
    Bevel3: TBevel;
    Label2: TLabel;
    leCourse1: TLabeledEdit;
    leCourse2: TLabeledEdit;
    leCity: TLabeledEdit;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

procedure SetSchool;

implementation

uses uGlobe;

{$R *.dfm}

procedure SetSchool;
  procedure GetSchoolInfo(AdlgSchool: TdlgSchool);
  begin
    AdlgSchool.leCity.Text := SchoolInfo.City;
    AdlgSchool.leName.Text := SchoolInfo.Name;
    AdlgSchool.leAddress.Text := SchoolInfo.Address;
    AdlgSchool.leRector.Text := SchoolInfo.Rector;
    AdlgSchool.leTel.Text := SchoolInfo.Tel;
    AdlgSchool.cbHasElementary.Checked := SchoolInfo.HasElementary;
    AdlgSchool.cbHasJunior.Checked := SchoolInfo.HasJunior;
    AdlgSchool.leCourse1.Text := SchoolInfo.ElementaryCourse;
    AdlgSchool.leCourse2.Text := SchoolInfo.JuniorCourse;
  end;

  procedure SetSchoolInfo(AdlgSchool: TdlgSchool);
  begin
    SchoolInfo.City := AdlgSchool.leCity.Text;
    SchoolInfo.Name := AdlgSchool.leName.Text;
    SchoolInfo.Address := AdlgSchool.leAddress.Text;
    SchoolInfo.Rector := AdlgSchool.leRector.Text;
    SchoolInfo.Tel := AdlgSchool.leTel.TexT;
    SchoolInfo.HasElementary := AdlgSchool.cbHasElementary.Checked;
    SchoolInfo.HasJunior := AdlgSchool.cbHasJunior.Checked;
    SchoolInfo.ElementaryCourse := AdlgSchool.leCourse1.Text;
    SchoolInfo.JuniorCourse := AdlgSchool.leCourse2.Text;

    with TIniFile.Create(IniFileName) do
    try
      WriteString(Ini_Section_School, 'City', SchoolInfo.City);
      WriteString(Ini_Section_School, 'Name', SchoolInfo.Name);
      WriteString(Ini_Section_School, 'Address', SchoolInfo.Address);
      WriteString(Ini_Section_School, 'Rector', SchoolInfo.Rector);
      WriteString(Ini_Section_School, 'Tel', SchoolInfo.Tel);
      WriteBool(Ini_Section_School, 'HasElementary', SchoolInfo.HasElementary);
      WriteBool(Ini_Section_School, 'HasJunior', SchoolInfo.HasJunior);
      WriteString(Ini_Section_Setup, 'ElementaryCourse', SchoolInfo.ElementaryCourse);
      WriteString(Ini_Section_Setup, 'JuniorCourse', SchoolInfo.JuniorCourse);
    finally
      Free;
    end;
  end;
var
  dlgSchool: TdlgSchool;
begin
  dlgSchool := TdlgSchool.Create(nil);
  try
    GetSchoolInfo(dlgSchool);
    if dlgSchool.ShowModal = mrOK then
      SetSchoolInfo(dlgSchool);
  except
    FreeAndNil(dlgSchool);
  end;
end;

end.

⌨️ 快捷键说明

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