📄 dblogdlg.pas
字号:
{ *************************************************************************** }
{ }
{ Kylix and Delphi Cross-Platform Visual Component Library }
{ }
{ Copyright (c) 1995, 2001 Borland Software Corporation }
{ }
{ *************************************************************************** }
unit DBLogDlg;
{$P+,H+,X+}
interface
uses SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, StdCtrls, ExtCtrls, DB, Mask, RzEdit;
type
TLoginDialog = class(TForm)
OKButton: TButton;
CancelButton: TButton;
Image1: TImage;
UserName: TEdit;
Password: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure FormShow(Sender: TObject);
end;
function LoginDialog(const ADatabaseName: string;
var AUserName, APassword: string): Boolean;
function LoginDialogEx(const ADatabaseName: string;
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
function RemoteLoginDialog(var AUserName, APassword: string): Boolean;
procedure SetCursorType(const CurIndex: Integer);
implementation
{$R *.dfm}
uses VDBConsts;
function LoginDialog(const ADatabaseName: string;
var AUserName, APassword: string): Boolean;
begin
with TLoginDialog.Create(Application) do
try
//DatabaseName.Caption := ADatabaseName;
UserName.Text := AUserName;
Result := False;
if AUserName = '' then ActiveControl := UserName;
if ShowModal = mrOk then
begin
AUserName := UserName.Text;
APassword := Password.Text;
Result := True;
end;
finally
Free;
end;
end;
function LoginDialogEx(const ADatabaseName: string;
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
begin
with TLoginDialog.Create(Application) do
try
//DatabaseName.Caption := ADatabaseName;
UserName.Text := AUserName;
Result := False;
if NameReadOnly then
UserName.Enabled := False
else
if AUserName = '' then ActiveControl := UserName;
if ShowModal = mrOk then
begin
AUserName := UserName.Text;
APassword := Password.Text;
Result := True;
end;
finally
Free;
end;
end;
function RemoteLoginDialog(var AUserName, APassword: string): Boolean;
begin
with TLoginDialog.Create(Application) do
try
Caption := SRemoteLogin;
//Bevel.Visible := False;
//DatabaseName.Visible := False;
//Label3.Visible := False;
//Panel.Height := Panel.Height - Bevel.Top;
//OKButton.Top := OKButton.Top - Bevel.Top;
//CancelButton.Top := CancelButton.Top - Bevel.Top;
//Height := Height - Bevel.Top;
UserName.Text := AUserName;
Result := False;
if AUserName = '' then ActiveControl := UserName;
if ShowModal = mrOk then
begin
AUserName := UserName.Text;
APassword := Password.Text;
Result := True;
end;
finally
Free;
end;
end;
procedure TLoginDialog.FormShow(Sender: TObject);
begin
UserName.Focused;
//if (DatabaseName.Width + DatabaseName.Left) >= Panel.ClientWidth then
// DatabaseName.Width := (Panel.ClientWidth - DatabaseName.Left) - 5;
end;
procedure SetCursorType(const CurIndex: Integer);
begin
Screen.Cursor := TCursor(CurIndex);
end;
initialization
if not Assigned(LoginDialogProc) then
LoginDialogProc := LoginDialog;
if not Assigned(LoginDialogExProc) then
LoginDialogExProc := LoginDialogEx;
if not Assigned(RemoteLoginDialogProc) then
RemoteLoginDialogProc := RemoteLoginDialog;
{
LoginDialogProc := LoginDialog;
LoginDialogExProc := LoginDialogEx;
RemoteLoginDialogProc := RemoteLoginDialog;
}
ScreenCursorProc := SetCursorType;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -