自己封装的InputBox,美化而已
用法:TfrmInputBox.GQInputBox('编辑跟进人','跟进人',VstFollower)
效果图:
unit uFrmInputBox; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, dxGDIPlusClasses, GQInterface, SysSvc, AdvGlassButton; type TfrmInputBox = class(TForm) lblAPrompt: TLabel; pnl1: TPanel; btnCancel: TAdvGlassButton; btnOK: TAdvGlassButton; pnlACaption: TPanel; edtAValue: TEdit; btn1: TSpeedButton; procedure btnCancelClick(Sender: TObject); procedure btnOKClick(Sender: TObject); procedure btnCancelMouseEnter(Sender: TObject); procedure btnCancelMouseLeave(Sender: TObject); procedure pnlACaptionMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure btn1Click(Sender: TObject); private public class function GQInputBox(const ACaption, APrompt, ADefault: string): string; end; var frmInputBox: TfrmInputBox; implementation {$R *.dfm} procedure TfrmInputBox.btn1Click(Sender: TObject); begin Self.ModalResult := mrCancel; end; procedure TfrmInputBox.btnCancelClick(Sender: TObject); begin Self.ModalResult := mrCancel; end; procedure TfrmInputBox.btnCancelMouseEnter(Sender: TObject); begin TAdvGlassButton(Sender).OuterBorderColor := $00E8AB1E; end; procedure TfrmInputBox.btnCancelMouseLeave(Sender: TObject); begin TAdvGlassButton(Sender).OuterBorderColor := clWhite; end; procedure TfrmInputBox.btnOKClick(Sender: TObject); begin Self.ModalResult := mrOk; end; class function TfrmInputBox.GQInputBox(const ACaption, APrompt, ADefault: string): string; begin Result := ADefault; frmInputBox := TfrmInputBox.Create(Application); with frmInputBox do try pnlACaption.Caption := ACaption; lblAPrompt.Caption := APrompt; edtAValue.Text := ADefault; // ; if ShowModal = mrOk then Result := edtAValue.Text; finally frmInputBox.Free; end; end; procedure TfrmInputBox.pnlACaptionMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ReleaseCapture; SendMessage(Self.Handle, WM_SYSCOMMAND, $F012, 0); end; end.
object frmInputBox: TfrmInputBox Left = 0 Top = 0 AutoSize = True BorderStyle = bsNone Caption = #36755#20837#26694 ClientHeight = 145 ClientWidth = 312 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poMainFormCenter PixelsPerInch = 96 TextHeight = 13 object pnl1: TPanel Left = 0 Top = 32 Width = 312 Height = 113 Align = alTop BevelOuter = bvNone Color = 16379355 ParentBackground = False TabOrder = 0 object lblAPrompt: TLabel Left = 19 Top = 19 Width = 28 Height = 20 Caption = #25552#31034 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -14 Font.Name = #24494#36719#38597#40657 Font.Style = [] ParentFont = False end object btnCancel: TAdvGlassButton Left = 94 Top = 64 Width = 85 Height = 28 Cursor = crHandPoint ParentCustomHint = False BackColor = clWhite BackGroundSymbolColor = clBtnFace ButtonDirection = bdLeft Caption = #21462#28040 CornerRadius = 5 Font.Charset = ANSI_CHARSET Font.Color = clBlack Font.Height = -14 Font.Name = #24494#36719#38597#40657 Font.Style = [] Font.Quality = fqClearType ForeColor = clWhite ForceTransparent = True GlowColor = clWhite InnerBorderColor = 15248158 Layout = blGlyphRight OuterBorderColor = clWhite ParentFont = False ParentShowHint = False ParentBiDiMode = False ShineColor = clWhite ShowHint = False Style = tasCheck TabOrder = 2 Version = '1.2.3.1' OnClick = btnCancelClick OnMouseEnter = btnCancelMouseEnter OnMouseLeave = btnCancelMouseLeave end object btnOK: TAdvGlassButton AlignWithMargins = True Left = 204 Top = 64 Width = 85 Height = 28 Cursor = crHandPoint ParentCustomHint = False BackColor = 15248936 BackGroundSymbolColor = 13998870 ButtonDirection = bdLeft Caption = #30830#35748 CornerRadius = 5 Down = True Font.Charset = ANSI_CHARSET Font.Color = clWhite Font.Height = -14 Font.Name = #24494#36719#38597#40657 Font.Style = [] Font.Quality = fqClearType ForeColor = 13998870 ForceTransparent = True GlowColor = 13998870 GroupIndex = 10 InnerBorderColor = 13998870 OuterBorderColor = clWhite ParentFont = False ParentShowHint = False ParentBiDiMode = False ShineColor = 13998870 ShortCutHintPos = shpCenter ShowHint = False TabOrder = 1 Version = '1.2.3.1' OnClick = btnOKClick OnMouseEnter = btnCancelMouseEnter OnMouseLeave = btnCancelMouseLeave end object edtAValue: TEdit Left = 84 Top = 19 Width = 205 Height = 21 ImeName = #20013#25991' ('#31616#20307') - '#25628#29399#25340#38899#36755#20837#27861 TabOrder = 0 end end object pnlACaption: TPanel Left = 0 Top = 0 Width = 312 Height = 32 Align = alTop BevelOuter = bvNone Caption = #26631#39064 Color = 14131462 Font.Charset = ANSI_CHARSET Font.Color = clWhite Font.Height = -16 Font.Name = #24494#36719#38597#40657 Font.Style = [] ParentBackground = False ParentFont = False TabOrder = 1 OnMouseDown = pnlACaptionMouseDown DesignSize = ( 312 32) object btn1: TSpeedButton Left = 289 Top = 5 Width = 23 Height = 22 Anchors = [akRight, akBottom] Caption = #935 Flat = True Font.Charset = DEFAULT_CHARSET Font.Color = clWhite Font.Height = -14 Font.Name = 'Tahoma' Font.Style = [fsBold] ParentFont = False OnClick = btn1Click end end end