Sign in Join
Wiki copytemporary

TForm/zh CN

Deutsch · English · Français · Suomi · Русский · 中文(中国) · 日本語

TForm 是 窗体 对象的类. 创建工程的所有Form都继承自TForm.

窗体表示形成应用程序的用户界面的窗口或应用程序. 它可以插入其他的组件 (例如: 按钮, 标签, 输入框, 图像...) 来建立我们的工程.

创建TForm的方式: File|new.... 【之类建议大家使用英文界面,新手可以使用中文,一旦熟悉后尽量切换到英文,因为中文模式部分情况下可能有bug】

Application

创建TForm方式: File|new... 或者直接点击新建图标,将会创建对应的类和单元. 为了使一个表单可以从另一个表单访问,需要将新表单添加到第一个表单单元的“uses”部分。 为了防止在每种形式都需要添加到另一种用途中时进行循环引用,需要在实现中将其添加到“uses”部分。 在程序启动时,实际上已实例化了主表单和任何其他必须“自动创建”的表单。 表单以它们在项目中列出的顺序开始。 自动创建窗体可以按照这个顺序操作 [Project|Project Options|Forms]. 如果由于某些原因可用的窗体未列出应自动创建的窗体, 将必要的窗体添加到 program's uses 的引用单元。 Application.CreateForm 来动态创建对应的窗体.

项目源码 PTest.lpr:

pascal
program PTest;
uses
  Forms,
  UMainForm,
  UOtherForm;
{$R *.res}

begin
  Application.Title:='Test';
  RequireDerivedFormResource := True;
  Application.Initialize();
  Application.CreateForm(TMainForm, MainForm);
  Application.CreateForm(TOtherForm, OtherForm);
  Application.Run();
end.

属性

事件

更多


From the Free Pascal wiki, page "TForm/zh CN", as it stood on 2021-02-12 after a change by TyphonFinger, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 1 person, 2021

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
TyphonFingerCreated page
TyphonFinger

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.