From 84e4ca9a157515ba2c69aa91d7c311433e74ed86 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 25 Dec 2011 23:06:13 +0000 Subject: [PATCH] Add some taskdialog style to login form. --- source/loginform.dfm | 123 ++++++++++++++++++++++++++----------------- source/loginform.pas | 14 +++-- 2 files changed, 85 insertions(+), 52 deletions(-) diff --git a/source/loginform.dfm b/source/loginform.dfm index 4aa1510c..477c0f00 100644 --- a/source/loginform.dfm +++ b/source/loginform.dfm @@ -3,8 +3,8 @@ object frmLogin: TfrmLogin Top = 0 BorderStyle = bsDialog Caption = 'Login' - ClientHeight = 117 - ClientWidth = 251 + ClientHeight = 137 + ClientWidth = 266 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -16,63 +16,90 @@ object frmLogin: TfrmLogin OnCreate = FormCreate OnShow = FormShow DesignSize = ( - 251 - 117) + 266 + 137) PixelsPerInch = 96 TextHeight = 13 - object lblPrompt: TLabel - Left = 8 - Top = 8 - Width = 44 - Height = 13 - Caption = 'lblPrompt' - end - object lblUsername: TLabel - Left = 8 - Top = 33 - Width = 52 - Height = 13 - Anchors = [akLeft, akBottom] - Caption = '&Username:' - FocusControl = editUsername - end - object lblPassword: TLabel - Left = 8 - Top = 60 - Width = 50 - Height = 13 - Anchors = [akLeft, akBottom] - Caption = '&Password:' - FocusControl = editPassword - end object btnOK: TButton - Left = 168 - Top = 84 + Left = 183 + Top = 104 Width = 75 Height = 25 Anchors = [akRight, akBottom] Caption = 'Login' Default = True ModalResult = 1 - TabOrder = 2 - end - object editPassword: TEdit - Left = 72 - Top = 57 - Width = 171 - Height = 21 - Anchors = [akLeft, akRight, akBottom] - PasswordChar = '*' TabOrder = 1 - Text = 'editPassword' + ExplicitLeft = 168 + ExplicitTop = 84 end - object editUsername: TEdit - Left = 72 - Top = 30 - Width = 171 - Height = 21 - Anchors = [akLeft, akRight, akBottom] + object pnlBackground: TPanel + Left = 0 + Top = 0 + Width = 266 + Height = 98 + Align = alTop + Anchors = [akLeft, akTop, akRight, akBottom] + BevelOuter = bvNone + Caption = 'pnlBackground' + Color = clWhite + ParentBackground = False + ShowCaption = False TabOrder = 0 - Text = 'editUsername' + ExplicitWidth = 305 + ExplicitHeight = 114 + DesignSize = ( + 266 + 98) + object lblPrompt: TLabel + Left = 38 + Top = 13 + Width = 44 + Height = 13 + Caption = 'lblPrompt' + end + object lblUsername: TLabel + Left = 38 + Top = 43 + Width = 52 + Height = 13 + Anchors = [akLeft, akBottom] + Caption = '&Username:' + FocusControl = editUsername + end + object lblPassword: TLabel + Left = 38 + Top = 70 + Width = 50 + Height = 13 + Anchors = [akLeft, akBottom] + Caption = '&Password:' + FocusControl = editPassword + end + object imgIcon: TImage + Left = 10 + Top = 13 + Width = 16 + Height = 16 + end + object editPassword: TEdit + Left = 104 + Top = 67 + Width = 154 + Height = 21 + Anchors = [akLeft, akRight, akBottom] + PasswordChar = '*' + TabOrder = 1 + Text = 'editPassword' + end + object editUsername: TEdit + Left = 104 + Top = 40 + Width = 154 + Height = 21 + Anchors = [akLeft, akRight, akBottom] + TabOrder = 0 + Text = 'editUsername' + end end end diff --git a/source/loginform.pas b/source/loginform.pas index afd5918a..779308d4 100644 --- a/source/loginform.pas +++ b/source/loginform.pas @@ -4,16 +4,18 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls; + Dialogs, StdCtrls, ExtCtrls; type TfrmLogin = class(TForm) btnOK: TButton; - editPassword: TEdit; + pnlBackground: TPanel; lblPrompt: TLabel; - editUsername: TEdit; lblUsername: TLabel; lblPassword: TLabel; + editPassword: TEdit; + editUsername: TEdit; + imgIcon: TImage; procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); private @@ -26,7 +28,7 @@ type implementation -uses helpers; +uses helpers, main; {$R *.dfm} {$I const.inc} @@ -55,6 +57,10 @@ procedure TfrmLogin.FormCreate(Sender: TObject); begin InheritFont(Font); Caption := APPNAME + ' - Login'; + MainForm.ImageListMain.GetBitmap(144, imgIcon.Picture.Bitmap); + lblPrompt.Font.Size := 10; + lblPrompt.Font.Color := clHotlight; + lblPrompt.Font.Style := lblPrompt.Font.Style + [fsBold]; end; procedure TfrmLogin.FormShow(Sender: TObject);