Difference between revisions of "TForm/zh CN"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "{{TForm}} '''TForm''' is the class of a form object. All forms created at design time can be derived from TForm. The form represents a window or dialog box that fo...")
 
 
Line 1: Line 1:
 
{{TForm}}
 
{{TForm}}
  
'''TForm''' is the [[Class|class]] of a form object. All forms created at design time can be derived from TForm.
+
'''TForm''' [[Class|窗体]] 对象的类. 创建工程的所有Form都继承自TForm.
  
The form represents a window or dialog box that forms the user interface of an [[Application|application]]. It is the container on which all other components (e.g. [[TButton|buttons]], [[TLabel|labels]], [[TEdit|edit fields]], [[TImage|images]]...) can be inserted.
+
窗体表示形成应用程序的用户界面的窗口或[[Application|应用程序]]. 它可以插入其他的组件 (例如: [[TButton|按钮]], [[TLabel|标签]], [[TEdit|输入框]], [[TImage|图像]]...) 来建立我们的工程.
  
A new TForm can be created using [[IDE Window: New Item|File<nowiki>|</nowiki>new...]].
+
创建TForm的方式: [[IDE 界面: New Item|File<nowiki>|</nowiki>new...]]. 【之类建议大家使用英文界面,新手可以使用中文,一旦熟悉后尽量切换到英文,因为中文模式部分情况下可能有bug】
  
 
== Application ==
 
== Application ==
  
Forms created at design time using [[IDE Window: New Item|File<nowiki>|</nowiki>new...]] or clicking the new Form button, will create a new class or unit. To make one form accessable from another requires the new form to be added to the uses section of the unit for first form. To prevent circular referencing when each form requires to be added to the uses of the other, this will need to be added to a uses section under implementation.
+
创建TForm方式: [[IDE Window: New Item|File<nowiki>|</nowiki>new...]] 或者直接点击新建图标,将会创建对应的类和单元. 为了使一个表单可以从另一个表单访问,需要将新表单添加到第一个表单单元的“uses”部分。 为了防止在每种形式都需要添加到另一种用途中时进行循环引用,需要在实现中将其添加到“uses”部分。
At program start, the main form and any other form that has to be 'autocreated' is actually instantiated. The forms are started in the sequence they are listed in the project. Autocreate forms may be selected from available forms in [Project|Project Options|Forms]. If for some reason available forms do not list the form that should be autocreated, add the necessary  form name to the [[Program|program]]'s [[Uses|uses]] clause and add a line <tt>Application.CreateForm</tt> for that form.
+
在程序启动时,实际上已实例化了主表单和任何其他必须“自动创建”的表单。 表单以它们在项目中列出的顺序开始。  自动创建窗体可以按照这个顺序操作 [Project|Project Options|Forms]. 如果由于某些原因可用的窗体未列出应自动创建的窗体, 将必要的窗体添加到 [[Program|program]]'s [[Uses|uses]] 的引用单元。 <tt>Application.CreateForm</tt> 来动态创建对应的窗体.
  
The project source code PTest.lpr:  
+
项目源码 PTest.lpr:  
  
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
Line 32: Line 32:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Properties ==
+
== 属性 ==
  
 
* [[Action]], [[ActiveControl]], [[Align]], [[AllowDropFiles]], [[AlphaBlend]], [[AlphaBlendValue]], [[Anchors]], [[AutoScroll]], [[AutoSize]], [[BiDiMode]], [[BorderIcons]], [[BorderStyle]], [[BorderWidth]], [[Caption]], [[ChildSizing]], [[Color]], [[Constraints]], [[Cursor]], [[DefaultMonitor]], [[DesignTimePPI]], [[DockSite]], [[DragKind]], [[DragMode]], [[Enabled]], [[Font]], [[FormStyle]], [[Height]], [[HelpKeyword]], [[HelpType]], [[Hint]], [[HorzScrollBar]], [[Icon]], [[KeyPreview]], [[Left]], [[Menu]], [[Name]], [[ParentBiDiMode]], [[ParentFont]], [[PixelsPerInch]], [[PopupMenu]], [[PopupMode]], [[PopupParent]], [[Position]], [[Scaled]], [[SessionProperties]], [[ShowHint]], [[ShowInTaskBar]], [[Tag]], [[Top]], [[UseDockManager]], [[VertScrollBar]], [[Visible]], [[Width]], [[WindowState]]
 
* [[Action]], [[ActiveControl]], [[Align]], [[AllowDropFiles]], [[AlphaBlend]], [[AlphaBlendValue]], [[Anchors]], [[AutoScroll]], [[AutoSize]], [[BiDiMode]], [[BorderIcons]], [[BorderStyle]], [[BorderWidth]], [[Caption]], [[ChildSizing]], [[Color]], [[Constraints]], [[Cursor]], [[DefaultMonitor]], [[DesignTimePPI]], [[DockSite]], [[DragKind]], [[DragMode]], [[Enabled]], [[Font]], [[FormStyle]], [[Height]], [[HelpKeyword]], [[HelpType]], [[Hint]], [[HorzScrollBar]], [[Icon]], [[KeyPreview]], [[Left]], [[Menu]], [[Name]], [[ParentBiDiMode]], [[ParentFont]], [[PixelsPerInch]], [[PopupMenu]], [[PopupMode]], [[PopupParent]], [[Position]], [[Scaled]], [[SessionProperties]], [[ShowHint]], [[ShowInTaskBar]], [[Tag]], [[Top]], [[UseDockManager]], [[VertScrollBar]], [[Visible]], [[Width]], [[WindowState]]
  
== Events ==
+
== 事件 ==
  
 
* [[Action]], [[ActiveControl]], [[Constraints]], [[Menu]], [[OnActivate]], [[OnChangeBounds]], [[OnClick]], [[OnClose]], [[OnCloseQuery]], [[OnConstrainedResize]], [[OnContextPopup]], [[OnCreate]], [[OnDblClick]], [[OnDeactivate]], [[OnDestroy]], [[OnDockDrop]], [[OnDockOver]], [[OnDragDrop]], [[OnDragOver]], [[OnDropFiles]], [[OnEndDock]], [[OnGetSiteInfo]], [[OnHelp]], [[OnHide]], [[key down | OnKeyDown]], [[OnKeyPress]], [[OnKeyUp]], [[OnMouseDown]], [[OnMouseEnter]], [[OnMouseLeave]], [[OnMouseUp]], [[OnMouseWheel]], [[OnMouseWheelDown]], [[OnMouseWheelUp]], [[OnPaint]], [[OnResize]], [[OnShortCut]], [[OnShow]], [[OnShowHint]], [[OnStratDock]], [[OnUnDock]], [[OnUTF8KeyPress]], [[OnWindowStateChange]], [[PopupMenu]], [[PopupParent]]
 
* [[Action]], [[ActiveControl]], [[Constraints]], [[Menu]], [[OnActivate]], [[OnChangeBounds]], [[OnClick]], [[OnClose]], [[OnCloseQuery]], [[OnConstrainedResize]], [[OnContextPopup]], [[OnCreate]], [[OnDblClick]], [[OnDeactivate]], [[OnDestroy]], [[OnDockDrop]], [[OnDockOver]], [[OnDragDrop]], [[OnDragOver]], [[OnDropFiles]], [[OnEndDock]], [[OnGetSiteInfo]], [[OnHelp]], [[OnHide]], [[key down | OnKeyDown]], [[OnKeyPress]], [[OnKeyUp]], [[OnMouseDown]], [[OnMouseEnter]], [[OnMouseLeave]], [[OnMouseUp]], [[OnMouseWheel]], [[OnMouseWheelDown]], [[OnMouseWheelUp]], [[OnPaint]], [[OnResize]], [[OnShortCut]], [[OnShow]], [[OnShowHint]], [[OnStratDock]], [[OnUnDock]], [[OnUTF8KeyPress]], [[OnWindowStateChange]], [[PopupMenu]], [[PopupParent]]
  
== See also ==
+
== 更多 ==
  
 
* [[doc:lcl/forms/tform.html|TForm doc]]
 
* [[doc:lcl/forms/tform.html|TForm doc]]
 
* [[Form Tutorial]]
 
* [[Form Tutorial]]

Latest revision as of 07:59, 12 February 2021

Deutsch (de) English (en) suomi (fi) français (fr) 日本語 (ja) русский (ru) 中文(中国大陆)‎ (zh_CN)

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

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

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

Application

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

项目源码 PTest.lpr:

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.

属性

事件

更多