delphi 组件问题 请高手帮我解决答一下 下面是我的代码,为这个程序会tpanel组会乱跳,不是按顺序排列

[复制链接]
查看11 | 回复1 | 2011-6-21 10:05:47 | 显示全部楼层 |阅读模式
var
i:Integer;
Temp,Count:Integer;
Txt:string;
begin
CurN:=StrToInt(RightStr(TPanel(Sender).Name,1));

for i:=0 to Panel1.ControlCount-1 do
begin

if Panel1.Controls.ClassName='TPanel' then

begin

Temp:=StrToInt(RightStr(TPanel(Panel1.Controls).Name,1));

if Temp>CurN then

TPanel(Panel1.Controls).Align:=alBottom;

end;
end;
Count:=Panel1.ControlCount-1;
while Count>=0 do
begin

if Panel1.Controls[Count].ClassName='TPanel' then

begin

Temp:=StrToInt(RightStr(TPanel(Panel1.Controls[Count]).Name,1));

if Temp'' then

begin

Lw.Items.Add.Caption:='
'+Txt+'
';

end;
end;
end;
点击一panel组件,那个P6,P5,P4会顺序会倒到来,可不可让它按顺序排列
例如我组件面板是P1--到P6,点击了p3,下面的p3下的所有panel组件会按顺序排列
P4到P6这样排列

回复

使用道具 举报

千问 | 2011-6-21 10:05:47 | 显示全部楼层
//是不是要这样的效果vari,position :Integer;p :TPanel;beginposition := StrToInt(RightStr(TPanel(Sender).Name,1));for i := 1 to position dobegin
p := TPanel(Sender).Parent.FindChildControl('P' + IntToStr(i)) as TPanel;
p.Top := (i - 1) * p.Height;
p.Align := alTop;end;for i := 6 downto position + 1 do...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行