在工程选项里设置就可以了
工程->选项->FORMS->Main Forms设置一下就可以了
你可以在工程文件里修改下,工程->查看工程源
rogram Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
Application.Initialize;
if 情况A then //这里设置你自己的条件
begin
Application.CreateForm(TForm1, Form1);
end
else ;
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
举个ScaleBy的例子吧,这个例子会使窗口中的控件随窗口宽度的大小而变化。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
OldWidth:Integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Pos('dke',Richedit1.Lines.Text);
end;
procedure TForm1.FormResize(Sender: TObject);
begin
form1.ScaleBy(Self.Width,OldWidth);
OldWidth:=Self.width;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
OldWidth:=Self.width;
end;
end.
Application.CreateForm这个是创建主窗体的