Firemonkey TFrame Align = Scale Bug?

时间:2017-11-23 13:34:59

标签: delphi scale frame firemonkey

我怀疑。我在firemonkey中创建了一个Frame并添加了2个按钮,然后在MainForm中添加了这个Frame。

Frame.Align = Scale

在MainForm中对象Frame.Align = Client

当我编译并调整表格大小时,框架不会缩放。

这是正常的问题还是错误?

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 481
  ClientWidth = 627
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  inline Frame21: TFrame2
    Align = Scale
    Position.Y = -3.000000000000000000
    Size.Width = 887.000000000000000000
    Size.Height = 653.000000000000000000
    Size.PlatformDefault = False
  end
end

object Frame2: TFrame2
  Align = Scale
  Size.Width = 526.000000000000000000
  Size.Height = 395.000000000000000000
  Size.PlatformDefault = False
  object Button1: TButton
    Position.X = 80.000000000000000000
    Position.Y = 40.000000000000000000
    TabOrder = 0
    Text = 'Button1'
  end
  object Button2: TButton
    Position.X = 144.000000000000000000
    Position.Y = 144.000000000000000000
    TabOrder = 1
    Text = 'Button2'
  end
  object Button3: TButton
    Position.X = 240.000000000000000000
    Position.Y = 256.000000000000000000
    TabOrder = 2
    Text = 'Button3'
  end
end

1 个答案:

答案 0 :(得分:3)

不,框架中Align = Scale没有错误。您似乎只有框架本身与Scale对齐。

如果您希望框架上的组件也可以缩放,您还需要分配它们的Align属性。

这是我的表格

object Form22: TForm22
  Left = 0
  Top = 0
  Caption = 'Form22'
  ClientHeight = 200
  ClientWidth = 350
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  inline Frame221: TFrame22
    Align = Scale
    Position.X = 16.000000000000000000
    Position.Y = 14.000000000000000000
    Size.Width = 320.000000000000000000
    Size.Height = 171.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 1
    inherited Label1: TLabel
      Position.X = 16.000000000000000000
      Position.Y = 24.000000000000000000
    end
    inherited Button1: TButton
      Position.Y = 48.857139587402340000
      Size.Height = 19.193893432617190000
      Size.PlatformDefault = False
    end
    inherited Button2: TButton
      Position.Y = 48.857139587402340000
      Size.Height = 19.193893432617190000
      Size.PlatformDefault = False
    end
    inherited Rectangle1: TRectangle
      Position.Y = 76.775512695312500000
      Size.Height = 77.647918701171880000
    end
  end
end

框架

object Frame22: TFrame22
  Align = Scale
  Size.Width = 320.000000000000000000
  Size.Height = 196.000000000000000000
  Size.PlatformDefault = False
  TabOrder = 0
  object Label1: TLabel
    Position.X = 32.000000000000000000
    Position.Y = 32.000000000000000000
    Text = 'Frame here!'
  end
  object Button1: TButton
    Align = Scale
    Position.X = 16.000000000000000000
    Position.Y = 56.000000000000000000
    TabOrder = 1
    Text = 'Button1'
  end
  object Button2: TButton
    Align = Scale
    Position.X = 216.000000000000000000
    Position.Y = 56.000000000000000000
    TabOrder = 2
    Text = 'Button2'
  end
  object Rectangle1: TRectangle
    Align = Scale
    Position.X = 16.000000000000000000
    Position.Y = 88.000000000000000000
    Size.Width = 281.000000000000000000
    Size.Height = 89.000000000000000000
    Size.PlatformDefault = False
  end
end

请注意,所有组件(TLabel除外)都将Align属性设置为Scale