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;会了吗,别忘给分。
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;会了吗,别忘给分。
//拖吧
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
俺不会,
只能关注此问题乐。