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

📄 unit2.~pas

📁 ceshi de bu yao xiazai
💻 ~PAS
字号:
unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    Lb1: TListBox;
    Edit1: TEdit;
    BitBtn1: TBitBtn;
    Lb2: TListBox;
    Cb1: TComboBox;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure Lb1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure Cb1Change(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
    function   readini(filename,section,ident:string):string;
    function   writeini(filename,section,ident,writestr:string):boolean;
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

uses unit1;

function   TForm2.readini(filename,section,ident:string):string;
var readstr,filen:string;
    inifile:Tinifile;
begin
    filen:=extractfilepath(application.ExeName)+filename;
    inifile:=Tinifile.Create(filen);
    readstr:=inifile.ReadString(section,ident,'');
    result:=readstr;
end;

function   TForm2.writeini(filename,section,ident,writestr:string):boolean;
var str,filen:string;
    inifile:Tinifile;
begin
    filen:=extractfilepath(application.ExeName)+filename;
    inifile:=Tinifile.Create(filen);
    inifile.WriteString(section,ident,writestr);
    result:=true;
end;

procedure TForm2.FormShow(Sender: TObject);
var
  sqlstr:string;
  timebookini:Tinifile;
begin
  sqlstr:='select hrd01,hrd02 from sfchr.hrd_file order by hrd01';
  Cb1.Clear;
  with Form1.sfcqy do
  begin
    close;
    sql.Clear;
    sql.Add(sqlstr);
    open;
    first;
    while not eof do
    begin
      Cb1.Items.Add(fields[0].AsString+'-'+fields[1].AsString);
      next;
    end;
  end;
  Lb1.Clear;
  try
    timebookini:=tinifile.Create(extractfilepath(application.ExeName)+'timebook.ini');
    timebookini.ReadSection('TIME',Lb1.Items);
  finally
     timebookini.Free;
  end;
end;

procedure TForm2.BitBtn1Click(Sender: TObject);
begin
  if length(trim(edit1.Text)) <> 6 then
  begin
    showmessage('

⌨️ 快捷键说明

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