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

📄 unitinputcode.pas

📁 delphi写的天一马,,学习用..希望有用的拿去
💻 PAS
字号:
unit UnitInputCode;

interface

uses stdctrls,buttons,dbierrs,DBTables,bde,dialogs,TLHelp32,windows,Sysutils,forms,classes,winsock,FileCtrl,
     Controls,math, GradBtn, Hemibtn;

type
  TFormInputCode = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    BitBtn1: THemisphereButton;
    BitBtn2: THemisphereButton;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  function InputboxCode(Acaption,Aprompt1,Adefault1,Aprompt2,Adefault2:string;PasswordChar:char):string;

implementation

{$R *.DFM}

function InputboxCode(Acaption,Aprompt1,Adefault1,Aprompt2,Adefault2:string;PasswordChar:char):string;
var
   FormInputCode:TFormInputCode;
   len:integer;
begin
   Application.CreateForm(TFormInputCode,FormInputCode);
   with FormInputCode do
   begin
      Caption:=Acaption;
      Label1.caption:=Aprompt1;
      Edit1.PasswordChar:=PasswordChar;
      Edit1.Left:=Label1.Left+Label1.Width+10;
      Edit1.text:=Adefault1;
      len:=length(edit1.text);
      if len<=3 then len:=3;
      Edit1.Width:=trunc(len*1.5*7.4);

      Label2.caption:=Aprompt2;
      Edit2.text:=Adefault2;
      Edit2.Left:=Edit1.Left;
      Edit2.Width:=Edit1.Width;

      Width:=Edit1.Left+Edit1.Width+20;
      BitBtn1.Left:=Width div 2 -10 - BitBtn1.Width;
      BitBtn2.Left:=Width div 2 +10;
      if ShowModal=mryes then result:=edit2.text
      else result:='';
      free;
   end;
end;

procedure TFormInputCode.BitBtn1Click(Sender: TObject);
begin
   close;
   ModalResult:=mrYes;
end;

procedure TFormInputCode.BitBtn2Click(Sender: TObject);
begin
   close;
   ModalResult:=mrNo;
end;

end.

⌨️ 快捷键说明

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