比如有10个edit,已经排好对齐位置,我单击button1需要把其中几个edit隐藏掉,这样需要把剩下的edit重新对齐排列,程序该怎么实现?

解决方案 »

  1.   

    你设置它们的left,和top就可以了!
      

  2.   

    在程序里面,设定具体的 LEFT TOP数值即可。
      

  3.   

    这两个属性我知道,关键我得知道该设置哪几个edit的这两个属性
    也就是怎么找出没有隐藏的edit然后设置他的left和top
      

  4.   

    var
      t,l,i:integer;
    begin
    t:=25;
    l:=30;
    for I := 0 to Self.ComponentCount - 1 do
        if Self.Components[i] is TEdit then
        begin
          TEdit(Self.Components[I]).top:=t;
          TEdit(Self.Components[I]).left:=l;
          t:=t+30;
        end;
    end;
      

  5.   

    楼上的方法对隐藏的edit会遍历吗?
    因为隐藏了几个所以要重新排列
      

  6.   

    var
      t,l,i:integer;
    begin
      t:=25;
      l:=30;
      for I := 0 to ComponentCount - 1 do
      if Components[i] is TEdit then
      begin
        if TEdit(Components[i]).Visible then
        begin
          TEdit(Components[I]).top:=t;
          TEdit(Components[I]).left:=l;
          t:=t+30;
        end;
      end;
    end;
      

  7.   

    最好用TPanel放置TEdit这样只要调整TPanel的位置就可以了,也可以用TCoolBar调整