帮忙分析这段句子,如果在程序中用他调用其它窗体需要注意什么问题? ( 积分: 50 )

  • 主题发起人 主题发起人 anchony
  • 开始时间 开始时间
A

anchony

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFrmMainControl.ShowPanel(xPanel: TPanel);
var
I: Integer;
AControl: TControl;
begin
xPanel.Parent := pnParent;
xPanel.Left := 0;
xPanel.Top := 0;
//SetButtonsParent;
xPanel.Visible := True;
for I := 0 to pnParent.ControlCount - 1 do
begin
AControl := pnParent.Controls;
if (AControl is TPanel) and (AControl <> xPanel) then
AControl.Visible := False;
end;
end;
 
procedure TFrmMainControl.ShowPanel(xPanel: TPanel);
var
I: Integer;
AControl: TControl;
begin
xPanel.Parent := pnParent;
xPanel.Left := 0;
xPanel.Top := 0;
//SetButtonsParent;
xPanel.Visible := True;
for I := 0 to pnParent.ControlCount - 1 do
begin
AControl := pnParent.Controls;
if (AControl is TPanel) and (AControl <> xPanel) then
AControl.Visible := False;
end;
end;
 
procedure TFrmMainControl.ShowPanel(xPanel: TPanel);
var
I: Integer;
AControl: TControl;
begin
xPanel.Parent := pnParent;
xPanel.Left := 0;
xPanel.Top := 0;
//SetButtonsParent;
xPanel.Visible := True;
//以上是将函数传进来的xPanle显示在pnParent

//下面是将pnParent容器中的Control除了xPanle以外,都设为不可见
for I := 0 to pnParent.ControlCount - 1 do
begin
AControl := pnParent.Controls;
if (AControl is TPanel) and (AControl <> xPanel) then
AControl.Visible := False;
end;
end;
 
你既然要把新的xPanel提到最前,别的控件全隐藏起来,为什么不用xPanel.bringtofront呢??
下面一段“将pnParent容器中的……设为不可见”,如果pnParent中的控件有不是TPanel的,不是不能隐藏了吗??
 
有什麼問題麼?
 
接受答案了.
 
后退
顶部