小弟的问题如下:
比如说有两个字符串 S := 'ABC'和 SR := 'FILE';
请问如何遍历访问窗口中所有的可视控件的Name属性,如果该控件的Name属性等于 S,那么设置他的Caption := SR;
请问该怎么做?大家一定帮忙啊,很急!!!
比如说有两个字符串 S := 'ABC'和 SR := 'FILE';
请问如何遍历访问窗口中所有的可视控件的Name属性,如果该控件的Name属性等于 S,那么设置他的Caption := SR;
请问该怎么做?大家一定帮忙啊,很急!!!
解决方案 »
- 觸發器問題
- 在函数中怎么得到一个过程中的一个参数的值.
- 推荐:www.coderpub.com 欢迎大家访问
- 散分拉 ,感谢大家,混个脸熟!/???为什么不让放200分???
- 求widestring与string 之间的转换函数
- 如何在LISTBOX中显示SQL表内一个字段'MC'
- QReport中DBText自动折行。
- 如何用代码实现将剪切板的内容粘贴到word中并重新全选再复制回剪切板???
- 谁能告诉我哪里有第三方控件下载吗?高分相送
- 关于sql server 连接不上
- 菜鸟提问:程序打包发布问题(sql server 2000+bde+多层) 使用installshield express
- 有关于GraphicEx的大问题哦~~~
for i:=0 to componentcount-1 do
id components[i] is TEdit then ...不过用Tag参数都是可以了
写错了一点
for i:=0 to componentcount-1 do
if components[i].Name = .. then ...
begin
for i:=0 to self.ComponentCount-1 do
begin
if self.Components[i] is tlabel then
begin
if Tlabel(self.Components[i]).name=s then
begin
Tlabel(self.Components[i]).caption=sr
end;
end;
end;
published
property Text;
end;var
Component : TCoontrol;
begin
Component := TControl(FindComponent(S));
if Component <> nil then TControlEx(Component).Text := SR;
end;
begin
if Components[i] is TEdit then ...
if Components[i].Name = .. then ...
end;
begin
for i:=0 to self.ComponentCount-1 do
begin
if self.Components[i] is TLabel then
begin
if Tlabel(self.Components[i]).name=s then
begin
Tlabel(self.Components[i]).caption=sr
end;
end;
end;上面的 TLabel 会提示没有声明。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~你uses TLabel了吗?
from delphi help
TControl is the base class for all components that are visible at runtime.下面是实现:
for i:=0 to self.ControlCount-1 do begin
if self.Controls[i].Name =S then
self.Controls[i].Name :=SR //对timer等非可视化控件,在此设置断点,根本得不到运行
end;
不过 self.Controls[i].Name :=SR 也可以改变 self.Controls[i]的caption的
嘻嘻,投机取巧了所以正确答案(不是最好,但最简单,不过只能是符合控件名称的字符串,汉字就不行了)是:
for i:=0 to self.ControlCount-1 do begin
if self.Controls[i].Name =S then
self.Controls[i].Name :=SR ;
end;
for i:=0 to Self.ControlCount-1 do
if (Self.Controls[i] is TWinControl)and(Self.Controls[i].Name ='S') then
SetWindowText((Self.Controls[i] as TWinControl).Handle,'SR');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~你uses TLabel了吗?
~~~~~~~~~~~~~~~~~~~~~~~~~~说错了,应该是uses StdCtrls
各位大哥帮帮忙啊
在win95中, user.exe使用两个32-bit heaps。其中一个用来储存WND 结构。另一個32-bit heap 用来存放menu。
可见wnd与menu是两种孑然不同的东西.
Nt没研究过
....