Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Asteristico no campo Senha


valSistemasDelphi
 Share

Question

5 answers to this question

Recommended Posts

  • 0

exemplo:

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);


//1) set  DBgrid1.DefaultDrawing:=false;

//2) put a TDBEdit on DBGrid1 and bind to the field you want;

//3) set DBEdit4.Passwordchar='*';


var l:integer;
var s:string;
begin
  DbGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
  if Column.FieldName='D1' then begin  //MyHidenField
    if not(gdFixed in State) then begin
      s:=Column.Field.AsString;
      for l:=1 to length(s) do s[l]:='*';
      //StatusBar1.SimpleText:=s+Format('[%d-%d]',[Rect.Left,REct.Top]);

      with (Sender as TDBGrid).Canvas do begin
        //Font.Color:=clRed;
        TextRect(Rect,Rect.Left,Rect.Top,s);
      end;
    end;
    if (gdFocused in State) then begin
      DBEdit4.Top   :=DBGrid1.Top   +Rect.Top;
      DBEdit4.Left  :=DBGrid1.Left  +Rect.Left+1;
      DBEdit4.Width :=Column.Width;
//      DBEdit4.height:=DBGrid1.Font.Height;
    end;
  end;
end;

 

abraço

Link to comment
Share on other sites

  • 0

OBS: quando voce monta um sistema em que a senha é colocada dentro de uma tabela, vale lembrar, que, se a senha não for encriptada, a mesma poderá ser descoberta, pela simples visualização da tabela

um campo senha nunca deve ser colocado em um dbgrid, somente na janela de login do sistema

abraço

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...