谢谢!

解决方案 »

  1.   

    ControlCountThis example uses an updown control and a group box on a form, with several controls contained within the group box. When the updown control is clicked, the controls within the group box are moved in the appropriate direction.procedure TForm1.UpDown1Click(Sender: TObject;Button: TUDBtnType);var
      I: Integer;
      ChildControl: TControl;
    begin
      for I:= 0 to GroupBox1.ControlCount -1 do
      begin
        ChildControl := GroupBox1.Controls[I];
        if Button = btNext then 
          ChildControl.Top := ChildControl.Top + 15
        else
          ChildControl.Top := ChildControl.Top - 15;
      end;end;
      

  2.   

    var
      I: Integer;
      ChildControl: TControl;
    begin
      for I:= 0 to GroupBox1.ControlCount -1 do
      begin
        ChildControl := GroupBox1.Controls[I];
        if ChildControl is TButton then //要一一判断啊。
        begin
          with ChildControl as TButton do
          begin
          //你的处理代码
          end;
        end;
        ...
       end;
      

  3.   

    GroupBox1.ControlCount就是它上面有几个控件
    for i := 0 to GroupBox1.ControlCount - 1 do
      ShowMessage('控件类名: ' + GroupBox1.Controls[i].ClassName + sLineBreak + '控件名: ' + GroupBox1.Controls[i].Name);