使用 Win32:文件 | 新单元然后您就可以完全控制代码。
var
F : TForm;
L : TLabel;
begin
F := TForm.Create(Application);
L := TLabel.Create(F);
L.Parent := F; // Needed to have it show up on the form.
L.Left := 50;
L.Top := 50;
L.Caption := 'This is an example';
F.Show;
end;
Run Code Online (Sandbox Code Playgroud)
在 .NET / Delphi Prism 中:右键单击项目|新建项目|类
namespace WindowsApplication2.Properties;
interface
uses
System.Windows.Forms,
System.Collections.Generic,
System.Linq,
System.Text;
type
Class1 = public class(System.Windows.Forms.Form)
private
protected
lablel1 : Label;
public
constructor;
end;
implementation
constructor Class1;
begin
self.label1 := new System.Windows.Forms.Label();
self.SuspendLayout();
self.label1.AutoSize := true;
self.label1.Location := new System.Drawing.Point(37, 80);
self.label1.Name := 'label1';
self.label1.Size := new System.Drawing.Size(35, 13);
self.label1.TabIndex := 0;
self.label1.Text := 'This is an Example';
self.ResumeLayout(false);
self.PerformLayout();
end;
end.
Run Code Online (Sandbox Code Playgroud)