procedure TSetupForm.FormActivate(Sender: TObject);
begin
OnActivate:=nil;
pReg:=nil;
try
pReg:=TRegistry.Create();
pReg.RootKey:=HKEY_LOCAL_MACHINE;
if pReg.OpenKey(SYSKEY,false)=true then //SYSKEY:系统键,比如:SYSKEY='\SoftWare\csdn'
begin
MaskEdit1.Text:=pReg.ReadString('Font');
MaskEdit2.Text:=pReg.ReadString('Position');
MaskEdit3.Text:=pReg.ReadString('User');
MaskEdit4.Text:=pReg.ReadString('Password');
end
finally
pReg.CloseKey;
end;
end;
begin
OnActivate:=nil;
pReg:=nil;
try
pReg:=TRegistry.Create();
pReg.RootKey:=HKEY_LOCAL_MACHINE;
if pReg.OpenKey(SYSKEY,false)=true then //SYSKEY:系统键,比如:SYSKEY='\SoftWare\csdn'
begin
MaskEdit1.Text:=pReg.ReadString('Font');
MaskEdit2.Text:=pReg.ReadString('Position');
MaskEdit3.Text:=pReg.ReadString('User');
MaskEdit4.Text:=pReg.ReadString('Password');
end
finally
pReg.CloseKey;
end;
end;
解决方案 »
- DevExpress 有像TOpenDialog那样的控件吗?
- 用delphi7获得本机在断网状态下网卡的mac地址 或硬盘的物理系列号
- 请教 怎样将 string 转为 PLongWord
- 怎么能显示这样的打印对话框?
- 登录窗体死活不下岗,实在无法,帮忙给看看啊 谢谢~ 谢谢
- ado方面的,如果更新数据?
- 编写一个短信中心,必须要向服务商拿哪些参数?
- □□升为4个角,散分!同时祝大家愚人节快乐□□
- 请教各位!帮delphi开发一个成绩管理系统如何入手?最好是C/S
- “不能启动更多事务”问题
- 用过pcAnyWhere的兄弟进来看看
- 用这个程序2个小时就可以给出300分,送出源代码,请到sunyuzhe.363.net下载
Registry, TypInfo;procedure TForm1.FormCreate(Sender: TObject);
begin
with TRegistry.Create do try
RootKey := HKEY_CURRENT_USER;
if OpenKey('\Software\MySoft\Font', False) then begin
Font.Name := ReadString('Name');
Font.Size := StrToIntDef(ReadString('Size'), 0);
Font.Color := StringToColor(ReadString('Color'));
SetSetProp(Font, 'Style', ReadString('Style'));
CloseKey;
end;
finally
Free;
end;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
with TRegistry.Create do try
RootKey := HKEY_CURRENT_USER;
if OpenKey('\Software\MySoft\Font', True) then begin
WriteString('Name', Font.Name);
WriteString('Size', IntToStr(Font.Size));
WriteString('Color', ColorToString(Font.Color));
WriteString('Style', GetSetProp(Font, 'Style'));
CloseKey;
end;
finally
Free;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if FontDialog1.Execute then Font.Assign(FontDialog1.Font);
end;
:p
GetSetProp()//获取集合属性
SetStrProp()//设置字符属性
GetStrProp()//获取字符属性
SetOrdProp()//设置有序属性
GetOrdProp()//获取有序属性