delphi菜单/new/...
然后弹出对话框,哪里能找到password diglog

解决方案 »

  1.   

    edit控件的一个属性设置一下就是一个加密框,忘了,好像是password属性,你认真的找一下
      

  2.   

    可以在主程序formcreate事件中调用密码对话框
      

  3.   

    同上!
    将EDit.passwordchar改为*
    自己作一个,很简单的。
      

  4.   

    -----------------如果不对,权当灌水-------------------
    在工程项目文件中写
    program gagl
    ....
    ...
     m_dysz in 'm_dysz.pas' {dysz};{$R *.RES}var
      count:integer;
    begin
      Application.Initialize;
      splashfrm:=tsplashfrm.create(application);
      splashfrm.show;
      splashfrm.update;
      for count:=0 to 400000000 do
      begin
      end;
      splashfrm.hide;
      splashfrm.free;
      gagl_dl:=Tgagl_dl.Create(application);
      gagl_dl.Showmodal;
      if gagl_dl.dl=false then
      begin
        exit;
        application.Terminate;
      end;
      Application.CreateForm(Tmain, main);
    --------------------下边是登录时的代码 .dfm-------------------
    bject gagl_dl: Tgagl_dl
      Left = 204
      Top = 185
      BorderIcons = []
      BorderStyle = bsSingle
      Caption = '用户登陆'
      ClientHeight = 177
      ClientWidth = 325
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      Position = poScreenCenter
      OnShow = FormShow
      PixelsPerInch = 96
      TextHeight = 13
      object Label4: TLabel
        Left = 82
        Top = 24
        Width = 206
        Height = 26
        Caption = '         请输入(或选择)操作员的姓名、密码和登录日期:'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = '宋体'
        Font.Style = []
        ParentFont = False
        WordWrap = True
      end
      object Bevel1: TBevel
        Left = 16
        Top = 13
        Width = 291
        Height = 124
        Shape = bsFrame
        Style = bsRaised
      end
      object Label1: TLabel
        Left = 95
        Top = 22
        Width = 12
        Height = 13
        Caption = '●'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clRed
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentFont = False
      end
      object Label2: TLabel
        Left = 108
        Top = 22
        Width = 12
        Height = 13
        Caption = '●'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGreen
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentFont = False
      end
      object Label3: TLabel
        Left = 119
        Top = 22
        Width = 12
        Height = 13
        Caption = '●'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clYellow
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentFont = False
      end
      object Image1: TImage
        Left = 22
        Top = 24
        Width = 49
        Height = 49
        Picture.Data = {图片太大了,我去掉了}
        Stretch = True
      end
      object Label6: TLabel
        Left = 82
        Top = 87
        Width = 47
        Height = 13
        Caption = '密码(&P)'
        FocusControl = Edit1
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = '宋体'
        Font.Style = []
        ParentFont = False
      end
      object Label7: TLabel
        Left = 82
        Top = 112
        Width = 47
        Height = 13
        Caption = '日期(&D)'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = '宋体'
        Font.Style = []
        ParentFont = False
      end
      object Label8: TLabel
        Left = 83
        Top = 61
        Width = 47
        Height = 13
        Caption = '单位(&C)'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = '宋体'
        Font.Style = []
        ParentFont = False
      end
      object Edit1: TEdit
        Left = 139
        Top = 83
        Width = 151
        Height = 21
        AutoSize = False
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -19
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        MaxLength = 10
        ParentFont = False
        PasswordChar = '*'
        TabOrder = 1
      end
      object DateTimePicker1: TDateTimePicker
        Left = 139
        Top = 108
        Width = 153
        Height = 20
        CalAlignment = dtaLeft
        Date = 37267.6436592708
        Time = 37267.6436592708
        DateFormat = dfLong
        DateMode = dmComboBox
        Kind = dtkDate
        ParseInput = False
        TabOrder = 2
      end
      object BitBtn2: TBitBtn
        Left = 144
        Top = 147
        Width = 75
        Height = 25
        Caption = '确定(&S)'
        Default = True
        TabOrder = 3
        OnClick = BitBtn2Click
        Glyph.Data = {
          图片太大了,我去掉了}
        NumGlyphs = 2
      end
      object BitBtn3: TBitBtn
        Left = 232
        Top = 147
        Width = 75
        Height = 25
        Caption = '取消(&G)'
        TabOrder = 4
        OnClick = BitBtn3Click
        Kind = bkCancel
      end
      object ComboBox1: TComboBox
        Left = 139
        Top = 57
        Width = 153
        Height = 21
        ItemHeight = 13
        TabOrder = 0
        Items.Strings = (
          '贺兰公安局'
          '永宁公安局'
          '城区分局')
      end
      object Query1: TQuery
        DatabaseName = 'gars'
        SQL.Strings = (
          '')
        Left = 24
        Top = 88
      end
      object Database1: TDatabase
        AliasName = 'gars'
        DatabaseName = 'gars'
        LoginPrompt = False
        SessionName = 'Default'
        Left = 64
        Top = 88
      end
    end
      

  5.   

    如果您还不知道 如何转化.dfm文件的话,如果您还不知道将EDit.passwordchar改为*的话,我无话可说,而且,上边的就当灌水;
    [email protected]
    给你所有你想要的:)
      

  6.   

    在PROJECT中加一个登陆窗体(好像已经有这种模板了),
    在主窗体创建前先创建这个窗体,检查密码!
    通过了才创建主窗体!
      

  7.   

    楼上的各位说的对!
    ================================================================
    一颗红心向前看,为了革命两茫然,不好意思才囊尽,只能说上一点点。
    ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
    ★    我踢  我踢   我踢  我踢  我踢  我踢  我踢  我踢  我踢   ★
    ★    你UP  你UP   你UP  你UP  你UP  你UP  你UP  你UP  你UP   ★
    ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
    ================================================================
      

  8.   

    在工程文件中调用密码form,若密码正确,调用初始化代码,否则退出
      

  9.   

    用一个密码数据库,可以设置权限的,通过访问数据库来添设密码。例子如下:
    unit Unit3;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, Mask, DB, ADODB, DBTables,unit6;type
      TForm3 = class(TForm)
        Label1: TLabel;
        Edit1: TEdit;
        Label2: TLabel;
        MaskEdit1: TMaskEdit;
        OkButton: TButton;
        CancleButton: TButton;
        ADOQuery1: TADOQuery;
        DataSource1: TDataSource;
        procedure FormCreate(Sender: TObject);
        procedure OkButtonClick(Sender: TObject);
        procedure CancleButtonClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form3: TForm3;
    implementationuses Unit1;{$R *.dfm}procedure TForm3.FormCreate(Sender: TObject);
    begin
    edit1.Text:='';
    maskedit1.Text:='';
    end;//身份认证程序
    procedure TForm3.OkButtonClick(Sender: TObject);
    begin
    if edit1.Text='' then
    edit1.setfocus
    else
    begin
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('Select * from IDTable');
    ADOQuery1.SQL.Add(' where 姓名='+QuotedStr(Edit1.Text));
    ADOQuery1.SQL.Add(' and 密码='+QuotedStr(MaskEdit1.Text));
    ADOQuery1.Open;
    if (ADOQuery1.RecordCount<>1)or(MaskEdit1.Text<>ADOQuery1.FieldValues['密码']) then
    begin
    ShowMessage('Password err,please check it!');
    edit1.SetFocus;
    end
    else
    begin
    if ADOQuery1.FieldValues['权限']='DBA' then
    begin
    Form3.Hide;
    Application.CreateForm(TForm1,Form1);
    Form1.Show;
    Form3.Free;
    end;
    if ADOQuery1.FieldValues['权限']='管理' then
    begin
    Form3.Hide;
    Application.CreateForm(TForm1,Form1);
    Form1.MainMenu1.Items[4].Items[0].Enabled:=False;
    Form1.MainMenu1.Items[4].Items[3].Enabled:=False;
    Form1.Show;
    Form3.Free;
    end;
    if ADOQuery1.FieldValues['权限']='查询' then
    begin
    Form3.Hide;
    Application.CreateForm(TForm1,Form1);
    Form1.MainMenu1.Items[1].Items[1].Enabled:=False;
    Form1.MainMenu1.Items[1].Items[2].Enabled:=False;
    Form1.MainMenu1.Items[1].Items[3].Enabled:=False;
    Form1.MainMenu1.Items[2].Items[0].Enabled:=False;
    Form1.MainMenu1.Items[4].Items[0].Enabled:=False;
    Form1.MainMenu1.Items[4].Items[3].Enabled:=False;
    Form1.Show;
    Form3.Free;
    end;
    end;
    end;
    end;procedure TForm3.CancleButtonClick(Sender: TObject);
    begin
    Application.Terminate;
    Close;
    end;end.
      

  10.   

    我有一个登录对话框的Form,只要简单地写一句代码即可调用,还可以记录上次登录的参数(口令当然不记),不过它只适用于MSSQL.我们的项目里基本上都用它.有兴趣的话可以与我联系 :)