T
tungh
Unregistered / Unconfirmed
GUEST, unregistred user!
请教。。unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Edit1: TEdit; Label1: TLabel; Label2: TLabel; edt1: TEdit; Edit2: TEdit; Button2: TButton; procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; aEdit: TEdit;implementation{$R *.dfm} Tmyedit= class(TEdit) public procedure wmGettext(var mes: TMessage);message wm_gettext; end;procedure TForm1.FormCreate(Sender: TObject);//var //aEdit: TEdit;begin aEdit:= Tmyedit.Create(Self); with aEdit do begin PasswordChar:= '*'; Left:= 60; //宽 top:= 100; //高 Name:= 'myedit'; Parent:= self; Visible:= true; end;end;{ Tmyedit }procedure Tmyedit.wmGettext(var mes: TMessage);begin //inherited; //加上这句就能获得密码了 //ShowMessage('想偷密码?想其他办法吧!');end;procedure TForm1.FormShow(Sender: TObject);begin aEdit.Text := (XML1.PassWord);//用这个的话,写入XML的时候就不正确 例如明明输入的是123456789 但是XML里却显示!? //edt1.Text := (XML1.PassWord);//只要用这个就正常,end;procedure TForm1.Button2Click(Sender: TObject);begin if not XML1.SetParameter('PassWord',aEdit.Text) then MessageDlg('修改配置文件错误!',mtCustom,[mbOk],0);end;end.或者其他什么方式能处理这个星号查看的问题,有例子更好