遍历两个panel上的控件传入参数值为 0 时,遍历2个Panel传入参数值为 1 时,遍历1个Panel怎么写一个通用的过程?for i := 0 to Panel[i].ComponentCount - 1 do
begin
if Panel[i].Components[i] is Edit then begin
if (Panel[i].Components[i] as Edit).Properties.ReadOnly = true then
Edit(Self.Components[i] as TcxDBTextEdit).Properties.ReadOnly := False;
end;
end;//Panel[i] 类似
begin
if Panel[i].Components[i] is Edit then begin
if (Panel[i].Components[i] as Edit).Properties.ReadOnly = true then
Edit(Self.Components[i] as TcxDBTextEdit).Properties.ReadOnly := False;
end;
end;//Panel[i] 类似
解决方案 »
- 如何合并文件和分离文件
- 学习Delphi有用吗??
- crc问题!前辈们救我!急急
- 再玩个游戏,用诗词接句子,看看大家还记得多少诗词,呵呵~~~~~~
- 清问我在用BDE查询数据的时候,总是提示“invalid BLOB handle in record buffer”, 请问是什么原因?
- 請問怎樣才可以讓delphi編譯的可執行文件比較小?
- StringGrid的问题,UP有分~
- csdn论坛的好助手--网页精灵
- 近呼完美的代码,竟然也出错(在关键字 'where' 附近有语法错误。.)
- 数据库软件的日期查询问题!!!
- delphi怎样将入库、出库、库存三个表的内容融合到一张表做成详细查询页面!
- 【delphiXE2】 终于弄出第一个IOS 的程序了
var i,j:integer;
Panel:array of Tpanel;
begin
setlength(Panel,2);
Panel[0]:=Form1.Panel1;//假定 Panel1 在 Form1 中
Panel[1]:=Form1.Panel2;//假定 Panel2 在 Form1 中
for j:=0 to 1-x do begin
for i := 0 to Panel[j].ComponentCount-1 do begin
if Panel[j].Components[i] is TEdit then begin
if (Panel[j].Components[i] as TEdit).Properties.ReadOnly then
//......
end;
end;
end;
end;
end;
EComponents;//遍历2个Panel
EComponents(1);//遍历1个Panel
procedure EComponents(const x:integer=0);
var i,j:integer;
Panel:array of Tpanel;
begin
setlength(Panel,2);
Panel[0]:=Form1.Panel1;//假定 Panel1 在 Form1 中
Panel[1]:=Form1.Panel2;//假定 Panel2 在 Form1 中
for j:=0 to 1-x do begin
for i := 0 to Panel[j].ComponentCount-1 do begin
if Panel[j].Components[i] is TEdit then begin
if (Panel[j].Components[i] as TEdit).Properties.ReadOnly then begin
//......
end;
end;
end;
end;
end;
var i:integer;
begin
for i := 0 to Pnl.ControlCount-1 do
begin
if Pnl.Controls[i] is Edit Then
begin
...
end;
end;
end;