unit uTestNEU;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data;
type
NewLabel = System.Windows.Forms.&
Label;
LabelArray =
array[0..10]
of NewLabel;
TestForm =
class(System.Windows.Forms.Form)
{$REGION 'Vom Designer verwalteter Code'}
strict private
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
Components : System.ComponentModel.Container;
Button1: System.Windows.Forms.Button;
Labels : LabelArray;
StartLabels : LabelArray;
Dummy: System.Windows.Forms.
Label;
Num : integer;
TextBox1: System.Windows.Forms.TextBox;
TextBox2: System.Windows.Forms.TextBox;
/// <summary>
/// Erforderliche Methode zur Unterstützung des Designers -
/// ändern Sie die Methode nicht mit dem Quelltext-Editor
/// </summary>
procedure InitializeComponent;
procedure Dummy_Click(sender: System.
Object; e: System.EventArgs);
procedure Button1_Click(sender: System.
Object; e: System.EventArgs);
{$ENDREGION}
strict protected
/// <summary>
/// Ressourcen nach der Verwendung bereinigen
/// </summary>
procedure Dispose(Disposing: Boolean);
override;
private
{ Private-Deklarationen }
public
constructor Create;
end;
var
StartKonfig : LabelArray;
[assembly: RuntimeRequiredAttribute(TypeOf(TestForm))]
implementation
{$AUTOBOX ON}
{$REGION 'Vom Windows Form-Designer erzeugter Code'}
/// <summary>
/// Erforderliche Methode zur Unterstützung des Designers --
/// ändern Sie die Methode nicht mit dem Quelltext-Editor
/// </summary>
procedure TestForm.InitializeComponent;
begin
Self.Button1 := System.Windows.Forms.Button.Create;
Self.Dummy := System.Windows.Forms.
Label.Create;
Self.TextBox1 := System.Windows.Forms.TextBox.Create;
Self.TextBox2 := System.Windows.Forms.TextBox.Create;
Self.SuspendLayout;
//
// Button1
//
Self.Button1.Location := System.Drawing.Point.Create(632, 16);
Self.Button1.
Name := '
Button1';
Self.Button1.TabIndex := 0;
Self.Button1.Text := '
Button1';
Include(Self.Button1.Click, Self.Button1_Click);
//
// Dummy
//
Self.Dummy.Location := System.Drawing.Point.Create(616, 568);
Self.Dummy.
Name := '
Dummy';
Self.Dummy.TabIndex := 1;
Self.Dummy.Text := '
Dummy';
Include(Self.Dummy.Click, Self.Dummy_Click);
//
// TextBox1
//
Self.TextBox1.Location := System.Drawing.Point.Create(568, 80);
Self.TextBox1.Multiline := True;
Self.TextBox1.
Name := '
TextBox1';
Self.TextBox1.Size := System.Drawing.Size.Create(100, 208);
Self.TextBox1.TabIndex := 2;
Self.TextBox1.Text := '
';
//
// TextBox2
//
Self.TextBox2.Location := System.Drawing.Point.Create(568, 320);
Self.TextBox2.Multiline := True;
Self.TextBox2.
Name := '
TextBox2';
Self.TextBox2.Size := System.Drawing.Size.Create(100, 208);
Self.TextBox2.TabIndex := 3;
Self.TextBox2.Text := '
';
//
// TestForm
//
Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 15);
Self.ClientSize := System.Drawing.Size.Create(728, 616);
Self.Controls.Add(Self.TextBox2);
Self.Controls.Add(Self.TextBox1);
Self.Controls.Add(Self.Dummy);
Self.Controls.Add(Self.Button1);
Self.
Name := '
TestForm';
Self.Text := '
WinForm';
Self.ResumeLayout(False);
end;
{$ENDREGION}
procedure TestForm.Dispose(Disposing: Boolean);
begin
if Disposing
then
begin
if Components <>
nil then
Components.Dispose();
end;
inherited Dispose(Disposing);
end;
constructor TestForm.Create;
var
i : integer;
begin
inherited Create;
//
// Erforderlich für die Unterstützung des Windows Forms-Designers
//
InitializeComponent;
//
// TODO: Fügen Sie nach dem Aufruf von InitializeComponent Konstruktorcode hinzu.
//
num := 0;
for i := 0
to 11 - 1
do
begin
Labels[i] := NewLabel.Create;
with Labels[i]
do
begin
Text := '
Label ' + i.ToString;
Left := 20;
Top := 20 + i*40;
BackColor := System.Drawing.Color.White;
BorderStyle := System.Windows.Forms.BorderStyle.Fixed3D;
Self.Controls.Add(Labels[i]);
Include(Labels[i].Click, Self.Dummy_Click);
end;
end;
// for i := 0 to 11 - 1 do
StartLabels := Labels;
StartKonfig := Labels;
end;
procedure TestForm.Button1_Click(sender: System.
Object; e: System.EventArgs);
var
i : integer;
begin
TextBox1.Text := '
';
TextBox2.Text := '
';
for i := 0
to 11 - 1
do
begin
TextBox1.Text := TextBox1.Text + StartLabels[i].Text+#13#10;
TextBox2.Text := TextBox2.Text + StartKonfig[i].Text+#13#10;
end;
end;
procedure TestForm.Dummy_Click(sender: System.
Object; e: System.EventArgs);
begin
if Sender
is System.Windows.Forms.&
Label then
(sender
as System.Windows.Forms.&
Label).Text := num.ToString;
inc(num);
end;
end.