procedure TForm1.Button1Click(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to ControlCount-1 do
  begin
    if Controls[i] is TLabel then
      Controls[i].Top:=Controls[i].Top-5;
  end;
end;会了吗,别忘给分。

解决方案 »

  1.   

    //pas
    //拖吧
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Label4: TLabel;
        Label5: TLabel;
        Label6: TLabel;
        Label7: TLabel;
        Label8: TLabel;
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}end.//dfm
    object Form1: TForm1
      Left = 192
      Top = 107
      Width = 544
      Height = 375
      Caption = 'Form1'
      Color = clBtnFace
      DockSite = True
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object Label1: TLabel
        Left = 80
        Top = 64
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label1'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label2: TLabel
        Left = 32
        Top = 120
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label2'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label3: TLabel
        Left = 264
        Top = 56
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label3'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label4: TLabel
        Left = 56
        Top = 192
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label4'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label5: TLabel
        Left = 288
        Top = 88
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label5'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label6: TLabel
        Left = 264
        Top = 128
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label6'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label7: TLabel
        Left = 128
        Top = 216
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label7'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
      object Label8: TLabel
        Left = 264
        Top = 192
        Width = 32
        Height = 13
        Cursor = crSizeAll
        Caption = 'Label8'
        DragKind = dkDock
        DragMode = dmAutomatic
      end
    end
      

  2.   

    如果你是要在程序运行时让所有Label移动相同或等差位移,用Liuzy的方法最好不过。还是不太明白你的意思,如果你是想把多个Label当成一个看待,再假如你的多个Label排列很有序,建议你用一个Label,如果是多行,在Caption属性(通过代码付值不可用Inspector付值)付值时在要换行的地方输入一个“#13”就可以了。
      

  3.   

    还有一个方法,如果是要一起拖动的话,将所有Label放入一个Panel就行了。然后拖动Panel要方便的多。
      

  4.   

    俺假设此兄欲问,如何任意用鼠标,任意移动(移动一个,或者两个,或者更多到任意位置),任意多个tlabel.可...
    俺不会,
    只能关注此问题乐。