主题:[讨论]请教panel奇怪的Align问题,希望能得到点拨
procedure TForm1.N2Click(Sender: TObject);
begin
self.Panel1.Align := alnone;
self.Panel2.Align := alnone;
self.Panel3.Align := alnone;
self.Panel4.Align := alnone;
self.Panel1.Align := alTop;
self.Panel2.Align := alClient;
//self.Panel2.Height := trunc(0.5 * self.Height);
self.Panel3.Visible := false;
//self.Panel3.Align := alTop;
self.Panel4.Visible := false;
//self.Panel4.Align := alClient;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
self.Panel1.Align := alnone;
self.Panel2.Align := alnone;
self.Panel3.Align := alnone;
self.Panel4.Align := alnone;
self.Panel1.Align := alTop;
self.Panel2.Align := alTop;
self.Panel2.Height := trunc(0.5 * self.Height);
self.Panel3.Align := alTop;
self.Panel3.Visible := true;
self.Panel4.Visible := true;
self.Panel4.Align := alClient;
end;
Form1中有4个panel,panel1, panel2, panel3,panel4从上到下的顺序,按照事件的不同,来改变其中几个的Align和visible属性,但是保持其相对位置不发生变化,,当点击N1->点击N2->点击N1后,panel3和panel1却互换了位置?请帮忙看看问题出在了那里?谢谢
begin
self.Panel1.Align := alnone;
self.Panel2.Align := alnone;
self.Panel3.Align := alnone;
self.Panel4.Align := alnone;
self.Panel1.Align := alTop;
self.Panel2.Align := alClient;
//self.Panel2.Height := trunc(0.5 * self.Height);
self.Panel3.Visible := false;
//self.Panel3.Align := alTop;
self.Panel4.Visible := false;
//self.Panel4.Align := alClient;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
self.Panel1.Align := alnone;
self.Panel2.Align := alnone;
self.Panel3.Align := alnone;
self.Panel4.Align := alnone;
self.Panel1.Align := alTop;
self.Panel2.Align := alTop;
self.Panel2.Height := trunc(0.5 * self.Height);
self.Panel3.Align := alTop;
self.Panel3.Visible := true;
self.Panel4.Visible := true;
self.Panel4.Align := alClient;
end;
Form1中有4个panel,panel1, panel2, panel3,panel4从上到下的顺序,按照事件的不同,来改变其中几个的Align和visible属性,但是保持其相对位置不发生变化,,当点击N1->点击N2->点击N1后,panel3和panel1却互换了位置?请帮忙看看问题出在了那里?谢谢