【问题标题】:Why does the FormFactor.Width and FormFactor.Height not change when a Delphi FMX application is resized?为什么在调整 Delphi FMX 应用程序大小时 FormFactor.Width 和 FormFactor.Height 不会改变?
【发布时间】:2021-04-08 02:20:33
【问题描述】:

我是一名长期的 Delphi VCL 开发人员,我刚刚开始学习 FMX。我创建了一个简单的小应用程序,它在内部显示 ClientHeightClientWidthFormFactor.WidthFormFactor.Height OnResize 事件处理程序中的 TMemo

这些是默认尺寸:

  • 客户端高度 = 381
  • 客户端宽度 = 420
  • Formactor.Width = 320
  • FormFactor.Height = 480

为什么FormFactor.WidthFormFactor.Height在应用主窗口调整大小时没有变化?

表单代码

  object Form1: TForm1
  Left = 0
  Top = 0
  BorderIcons = [biSystemMenu]
  Caption = 'Form1'
  ClientHeight = 381
  ClientWidth = 420
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  OnResize = FormResize
  DesignerMasterStyle = 0
  object Memo1: TMemo
    Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
    DataDetectorTypes = []
    Align = Center
    Anchors = [akLeft, akTop, akRight, akBottom]
    Size.Width = 385.000000000000000000
    Size.Height = 333.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 0
    Viewport.Width = 381.000000000000000000
    Viewport.Height = 329.000000000000000000
  end
  object StatusBar1: TStatusBar
    Position.Y = 359.000000000000000000
    ShowSizeGrip = True
    Size.Width = 420.000000000000000000
    Size.Height = 22.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 1
  end
end

程序代码

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types,
  FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo, FMX.StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    StatusBar1: TStatusBar;
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.FormResize(Sender: TObject);
begin
  Memo1.Lines.clear;
  Memo1.Lines.Add('ClientHeight:'      + #9#9 + Form1.ClientHeight.ToString);
  Memo1.Lines.Add('ClientWidth:'       + #9#9 + Form1.ClientWidth.ToString);
  Memo1.Lines.Add('FormFactor.Width:'  + #9   + Form1.FormFactor.Width.ToString);
  Memo1.Lines.Add('FormFactor.Height:' + #9   + Form1.FormFactor.Height.ToString);
end;

end.

【问题讨论】:

  • 请看documentation。它似乎只涉及 iOS,并根据目标设备选择而变化。
  • 谢谢@TomBrunberg。我查看的是库帮助页面,而不是 RADStudio 帮助页面。
  • 不客气

标签: delphi firemonkey


【解决方案1】:

我正在阅读 Delphi 附带的文档,按 [F1]。这只是技术参考。帮助文件有一个指向“当前 Docwiki 文章”的链接。我点击了这个链接,它把我带到了 wiki 的“RAD Studio Technical Library”部分。此 wiki 中的搜索框用于在库部分中进行搜索。

因此,我现在对如何使用 RAD Studio docwiki 的所有三个部分有了更好的理解。可以在此处找到有关充分利用 docwiki 的更多信息。 https://capecodgunny.blogspot.com/2021/04/turbo-boost-your-delphi-knowledge.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-28
    • 2012-07-18
    • 2016-03-09
    • 2013-03-07
    • 1970-01-01
    • 2019-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多