H
houtor
Unregistered / Unconfirmed
GUEST, unregistred user!
有Form1加上几个TSpeedButton和TPanel控件,代码如下:
for i := 0 to Form1.ControlCount-1 do begin
if Form1.Controls is TSpeedButton then
if TSpeedButton(Form1.Controls).Visible then
TSpeedButton(Form1.Controls).Visible:=False
else TSpeedButton(Form1.Controls).Visible:=True
else if Form1.Controls is TPanel then
if TPanel(Form1.Controls).Visible then
TPanel(Form1.Controls).Visible:=False
else TPanel(Form1.Controls).Visible:=True
end;
TSpeedButton可以,但if Form1.Controls is TPanel then下的根本不运行,难道TPanel控件不是Controls类型的吗(Form1.Controls is TPanel = false呀),如何改呀?
for i := 0 to Form1.ControlCount-1 do begin
if Form1.Controls is TSpeedButton then
if TSpeedButton(Form1.Controls).Visible then
TSpeedButton(Form1.Controls).Visible:=False
else TSpeedButton(Form1.Controls).Visible:=True
else if Form1.Controls is TPanel then
if TPanel(Form1.Controls).Visible then
TPanel(Form1.Controls).Visible:=False
else TPanel(Form1.Controls).Visible:=True
end;
TSpeedButton可以,但if Form1.Controls is TPanel then下的根本不运行,难道TPanel控件不是Controls类型的吗(Form1.Controls is TPanel = false呀),如何改呀?