我在panel上放了一个checkbox和 button1,现在我如何通过点击‘保存’(button2)来保存checkbox.left,checkbox.top,和button1.left,button1.top
请各位老大指点啊
在此先谢过了~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~解决者绝对给分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
请各位老大指点啊
在此先谢过了~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~解决者绝对给分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
解决方案 »
- 根据窗口句柄,如何获得程序的目录?
- USB转串口线的COM口侦测问题
- 该怎么阻止指针移动时提交插入数据?
- 急需!!!!!!!!!!!!!!!
- 如何在程序中关闭用winexec('explorer C:\test',1);资源管理器?在线等
- 关于MTS中IsharedProperty.Value与OleVariant的问题-100请教保证给分
- 这个文本文件的数据如何才能传送到数据库表中?
- 惭愧:关于文本和对象的混合编辑问题
- 50分,问很简单的alter语句
- 求教ImageEn,在虚拟视频上做上时间戳,但如何实现回传带了时间戳的图像?
- 在delphi7中如何将菜单设置为xp风格的,谢谢!
- help me!(有关activex form的!)
可以存入ini文件中或注册表中!
for i:=0 to ComponentCount-1 do
begin
if Components[i].ClassType=TCheckBox then
t:=TCheckBox(Components[i]).top;
end;
如果你回答对了,可以再加。我的问题是:
我想遍历整个FORM上的所有控件,包括容器内的控件(如FROM上的panel上的listbox,checkbox,label等),得到所有控件的基本设置属性(包括LEFT,TOP等),然后把这些属性加密后写入到一个INI文件中;
还有就是对FORM上的图片文件进行‘更换保存’操作,同时要把新的图片保存到一个位置,在INI文件中记录新图片的路径和名字。大家知道帮帮忙吧
谢了啊
procedure TForm1.Button1Click(Sender: TObject);
var
PropList: PPropList;
PropCount: Integer;
I,j: Integer;
kk,tt:tcomponent;
begin
for j:=0 to form1.ControlCount -1 do
begin
tt:= FORM1.Controls[j] ;
PropCount := GetTypeData(tt.ClassInfo)^.PropCount;
GetMem(PropList, PropCount * SizeOf(Pointer));
try
GetPropInfos(tt.ClassInfo, PropList);
memo1.Lines.Add('****************');
memo1.Lines.Add('控件名字:'+tt.Name );
for I := 0 to PropCount - 1 do
begin
if ('Top'= PropList[I].Name) or ('Left'=PropList[I].Name) then
begin
Memo1.Lines.Add(PropList[I].Name + '=' +
inttostr(getpropvalue(tt, PropList[I].Name)));
end;
end;
finally
FreeMem(PropList);
end;
end;
memo1.Lines.SaveToFile('c:\test.txt');
end;
//程序需要一个MEMO1 一个BUTTON1procedure TForm1.Button1Click(Sender: TObject);
var
PropList: PPropList;
PropCount: Integer;
I,j: Integer;
kk,tt:tcomponent;
begin
for j:=0 to form1.ComponentCount-1 do // 改一下写错了
//for j:=0 to form1.ControlCount -1 do
begin
tt:= FORM1.Controls[j] ;
PropCount := GetTypeData(tt.ClassInfo)^.PropCount;
GetMem(PropList, PropCount * SizeOf(Pointer));
try
GetPropInfos(tt.ClassInfo, PropList);
memo1.Lines.Add('****************');
memo1.Lines.Add('控件名字:'+tt.Name );
for I := 0 to PropCount - 1 do
begin
if ('Top'= PropList[I].Name) or ('Left'=PropList[I].Name) then
begin
Memo1.Lines.Add(PropList[I].Name + '=' +
inttostr(getpropvalue(tt, PropList[I].Name)));
end;
end;
finally
FreeMem(PropList);
end;
end;
memo1.Lines.SaveToFile('c:\test.txt');
end;
//程序需要一个MEMO1 一个BUTTON1procedure TForm1.Button1Click(Sender: TObject);
var
PropList: PPropList;
PropCount: Integer;
I,j: Integer;
kk,tt:tcomponent;
begin
for j:=0 to form1.ComponentCount-1 do // 改一下写错了
//for j:=0 to form1.ControlCount -1 do
begin
tt:= FORM1.Components[j];//这个地方也写错了,黑肚子饿了
PropCount := GetTypeData(tt.ClassInfo)^.PropCount;
GetMem(PropList, PropCount * SizeOf(Pointer));
try
GetPropInfos(tt.ClassInfo, PropList);
memo1.Lines.Add('****************');
memo1.Lines.Add('控件名字:'+tt.Name );
for I := 0 to PropCount - 1 do
begin
if ('Top'= PropList[I].Name) or ('Left'=PropList[I].Name) then
begin
Memo1.Lines.Add(PropList[I].Name + '=' +
inttostr(getpropvalue(tt, PropList[I].Name)));
end;
end;
finally
FreeMem(PropList);
end;
end;
memo1.Lines.SaveToFile('c:\test.txt');
end;
var PropList: PPropList;PropCount := GetTypeData(tt.ClassInfo)^.PropCount; GetMem(PropList, PropCount * SizeOf(Pointer)); GetPropInfos(tt.ClassInfo, PropList);
非常感谢
还有这几个函数过程:gettypedata(),getpropinfos 怎么都找不到帮助啊?
在哪里可以找到
begin
cleardata(panel1);
end;procedure TForm1.cleardata(Sender: TObject);
var i : Integer;
begin
if Sender is TPanel then
begin
for i:=0 to TPanel(Sender).ControlCount-1 do
Cleardata(TPanel(Sender).Controls[i]);
end;
showmessage(inttostr(TEdit(Sender).Left));
end;
你的代码有问题万一PANEL上面放一个TBUTTON了或者其他什么控件就不行了哟哈哈!
现在能存到INI文件中了,但还要从INI文件中读出来。在FORM创建时,动态生成INI中的组件,INI文件中存在组件的信息。
即把原来界面上的组件的位置大小信息从INI文件读出来,动态创建一遍再。
要求如PANEL上有CHECKBOX,在动态生成后还原到PANEL上。
还有如果有IMAGE文件,INI中还有IMAGE的存放路径,要求把原图象调出来显示在FORM上。如果解决了,再有50相送。INI文件形式如下:
[button]
left=10
top=20
height=30
width=50
[panel]
left=10
top=20
height=30
width=50
[checkbox]
left=10
top=20
height=30
width=50