If you right-click on the form and choose View as Text, then you are already a long way. Simply replace all =
's by :=
's, and create all components by adding .Create(Self)
.
So this text:
object Form1: TForm1
Left = 300
Top = 281
Width = 630
Height = 372
Caption = 'Form1'
Color = clBtnFace
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 = 14
Top = 28
Width = 32
Height = 13
Caption = 'Label1'
end
object Edit1: TEdit
Left = 63
Top = 24
Width = 121
Height = 21
TabOrder = 0
Text = 'Edit1'
end
end
should be converted into something like:
type
TMyForm1 = class(TForm)
private
Label1: TLabel;
Edit1: TEdit;
public
constructor Create(AOwner: TComponent); override;
end;
constructor TMyForm1.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Width := 630;
Height := 372;
Caption := 'Form1';
Color := clBtnFace;
...
Label1 := TLabel.Create(Self);
with Label1 do
begin
Left := 14;
Top := 28;
Width := 32;
Height := 13;
Caption := 'Label1';
end;
Edit1 := TEdit.Create(Self);
with Edit1 do
...
end;
But there are also tools for this special task, see Are there any Delphi DFM to Delphi source code convertion tools?.