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

📄 unit_m.pas

📁 这是一套小型家庭理财软件delphi源代码
💻 PAS
字号:
unit Unit_M;

interface

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

type
  TForm_M = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    ComboBox1: TComboBox;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    BitBtn1: TBitBtn;
    Bevel1: TBevel;
    Image1: TImage;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure ComboBox1CloseUp(Sender: TObject);
    procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
  private
    filepath : String;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_M: TForm_M;

implementation

uses jia, Unit_GL;

{$R *.dfm}

procedure TForm_M.FormShow(Sender: TObject);
var
  myinifile : TIniFile;
  i,n : Integer;
begin
  ComboBox1.Clear;
  filepath :=ExtractFilePath(Paramstr(0));
  myinifile :=Tinifile.Create(filepath+'data\Home.dft');
  try
    n:= myinifile.ReadInteger('name','n',1);
    if n = 0 then
      ComboBox1.items.Add(myinifile.ReadString('name','1','管理员'))
    else
    for i:=1 to n do
      ComboBox1.items.Add(myinifile.ReadString('name',IntToStr(i-1),'管理员'));
  finally
    myinifile.Destroy;
  end;
end;

procedure TForm_M.BitBtn1Click(Sender: TObject);
var
  myinifile : TIniFile;
  Mima1,Mima2,QX : String;
  I : Integer;
begin
  if ComboBox1.Text = '' then
  begin
    ComboBox1.SetFocus;
    exit;
  end;

  Mima1 := Form1.Mi(ComboBox1.Text,Edit1.Text);
  myinifile :=Tinifile.Create(filepath+'data\Home.dft');
  try
    Mima2 := myinifile.ReadString('name',ComboBox1.Text,'PXXHHPUHPHHDNWXYZCDQN'); //管理员密码为888888
    QX := copy(Mima2,8,1);
    Mima2 := copy(Mima2,1,7)+copy(Mima2,9,Length(Mima2)-8);
  finally
    myinifile.Destroy;
  end;

  if (Mima1 <>'')and(Mima1 = Mima2)  then
  begin
    Form_GL.ListBox_name.Clear;
    Form1.Name := ComboBox1.Text;
    for i:=0 to ComboBox1.Items.Count-1 do
      if ComboBox1.Items[i] = '管理员' then ComboBox1.Items.Delete(i);
    Form_GL.ListBox_name.Items := ComboBox1.Items;
    if QX = 'H' then begin Form1.NameQX :='管理员'; Form_GL.RadioButton_GLY1.Checked := True; end;
    if QX = 'O' then begin Form1.NameQX :='普通用户'; Form_GL.RadioButton_PT1.Checked := True; end;
    if QX = 'B' then begin Form1.NameQX :='游览用户'; Form_GL.RadioButton_YL1.Checked := True; end;
    Form1.StatusBar1.Panels[2].Text :=Form1.NameQX+': '+Form1.Name;
    Form1.doing := True;
    Close;
  end
  else
  begin
    ComboBox1.ItemIndex := -1;
    Edit1.Clear;
    ComboBox1.SetFocus;
  end;
end;

procedure TForm_M.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then BitBtn1Click(Sender);
end;

procedure TForm_M.ComboBox1CloseUp(Sender: TObject);
begin
  Edit1.SelectAll;
  Edit1.SetFocus;
end;

procedure TForm_M.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    Edit1.SetFocus;
end;

end.

⌨️ 快捷键说明

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