Einzelnen Beitrag anzeigen

DelphiUser1

Registriert seit: 15. Sep 2012
56 Beiträge
 
#1

Funktion in selbst erstellter Form

  Alt 29. Sep 2012, 14:22
Hallo alle miteinander
ich habe in der Klasse Treg=class(TForm) eine Form erstellt (myform). Diese wird während der Laufzeit erzeugt. In Unit1 habe ich eine function eingebaut, mit der ich ein Passwort verschlüsseln kann(function XorStr(const Text: string; Key: Integer): string). Der gesamte Quellcode für myform steht unten. Leider ändert sich Label3 nicht in die Verschlüsselung sondern die caption bleibt leer. Kann mir da jemand helfen?


Delphi-Quellcode:
myform:=TReg.CreateNew(Self);
with myform do
  begin
    visible := true;
    Caption := 'Registrieren(2/2)';
    Left := Form1.Left;
    Top := Form1.Top;
    ClientHeight := Form1.ClientHeight;
    ClientWidth := Form1.ClientWidth;
    Autoscroll:=false;
    Button1 := TButton.Create(myForm);
    end;
    With Button1 do
    begin
      parent := myForm;
      visible := true;
      caption := 'Prozess abschliessen';
      width:=120;
      left := 150;
      top := 150;
      OnClick := Button1Click;
    end;
    Edit1 := TEdit.Create(myForm);
    With Edit1 do
    begin
      parent := myForm;
      visible := true;
      left := 150;
      top := 50;
    end;
    Edit2 := TEdit.Create(myForm);
    With Edit2 do
    begin
      parent := myForm;
      visible := true;
      left := 150;
      top := 100;
    end;
    Label1:=TLabel.Create(myform);
  with Label1 do
  begin
  parent := myForm;
  Font.Color:=clblack;
  visible := true;
  left := 20;
  top := 100;
  Caption := 'Benutzername:';
  Font.Size:=12;
  end;
  Label2:=TLabel.Create(myform);
  with Label2 do
  begin
  Parent:=Myform;
  Visible:=true;
  left := 20;
  top := 50;
  Caption := 'Passwort:';
  Font.Size:=12;
  end;
  Label3:=TLabel.Create(myform);
  with Label3 do
  begin
  Parent:=Myform;
  Visible:=True;
  left := 200;
  top := 50;
  Caption := XorStr(Edit1.Text, 21);
  Font.Size:=10;
  Font.Color:=clblack;
  end;
   end;
  Mit Zitat antworten Zitat