promptform.pas
来自「著名的SecureBlackBox控件完整源码」· PAS 代码 · 共 45 行
PAS
45 行
unit PromptForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, SBUtils;
type
TfrmPrompt = class(TForm)
lblPrompt: TLabel;
edtResponse: TEdit;
btnOk: TButton;
btnCancel: TButton;
private
{ Private declarations }
public
{ Public declarations }
class function Prompt(const Request : string; ShowResponse : boolean; var Response : string) : boolean;
end;
implementation
{$R *.DFM}
class function TfrmPrompt.Prompt(const Request : string; ShowResponse : boolean; var Response : string) : boolean;
var Instance : TfrmPrompt;
begin
Instance := TfrmPrompt.Create(nil);
try
Instance.lblPrompt.Caption := Request;
if not ShowResponse then
Instance.edtResponse.PasswordChar := '*';
result := Instance.ShowModal = mrOk;
if Result then
Response := Instance.edtResponse.Text;
finally
FreeAndNil(Instance);
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?