【转载】Understanding and using FireMonkey Layouts

http://delphi.org/2015/12/skill-sprint-using-firemonkey-layouts/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+DelphiDotOrg+%28Delphi.org%29

Skill Sprint: Using FireMonkey Layouts

Understanding and using FireMonkey Layouts

FireMonkey and the FireUI makes it easy to build one form to rule all the platforms. Combining layout controls and making use of Anchors, Alignment, Padding and Margins it is easy to make one form that looks and works great on all platforms.

Anchors

  • Position relative to one or more edge(s) of parent:Anchor
    • Top
    • Bottom
    • Left
    • Right
  • Default is Top, Left
  • Moves with parent resize
  • Each control has 0 to 4 anchors

Alignment

  • Aligns control within parent, setting anchors, size and position.
  • Default is None.
  • Anchor and fill along edge:
    • Top, Bottom, Left, Right
  • Fill parent, but preserve aspect ratio:
    • Fit, FitLeft, FitRight
  • Fill along one side of the parent (priority over other edge alignments):
    • MostBottom, MostTop, MostLeft, MostRight
  • Resize only on one axis (width or height)
    • Vertical, VertCenter, Horizontal, HorzCenter
  • Miscellaneous
    • Client – Fills client area, less other children
    • Center – No resize, just centered
    • Contents – Fills client area, ignoring other children
    • Scale – resizes and moves to maintain the relative position and size

Spacing – Margins and Padding

  • MarginsMarginsAndPadding
    • Spacing for siblings (and parent edges)
  • Padding
    • Spacing for children

TFlowLayout

  • Arrange child controls like words in a paragraph
  • Controls arranged in order added to layout
    • Use “Move to Front” or “Send to Back” to reorder
  • Use TFlowLayoutBreak for forced line break

FlowLayout1 FlowLayout2

TGridLayout

  • Arranges child controls in a grid of equal sizes
  • Controls flow through grid as parent resizes
  • Use ItemWidth and ItemHeight properties
  • Customize margins of individual controls

GridLayout2 GridLayout1

TGridPanelLayout

  • Creates a grid of specified rows and columns
  • Does not change the anchor or size of child
  • Each cell can contain 1 child control
  • You set the Height, Width, Align, and Anchors of children
  • Controls can span multiple cells

GridPanelLayout2 GridPanelLayout1

TScaledLayout

  • Stretches child controls as it is resized at runtime
  • Doesn’t respect aspect ratios of controls
  • Set the Align of the TScaledLayout to Fit to maintain aspect ratio
  • Some styles look better zoomed than others. The font grows – it is not a bitmap scale.
  • Has properties for OriginalWidth and OriginalHeight – Compare to Width and Height to determine scaling.

ScaledLayout-Stretch

TScrollBox

TTabControl

  • Control to group child controls into tabs
  • Tabs are in a stack with one visible at a time
  • TabPosition := PlatformDefault to use platform default behavior
  • TabPosition := None to hide navigation
  • Use TTabChangeAction to animate transitions

Frames

  • Reusable pieces of User Interface
    • Includes
      • The layout
      • All the event handlers
      • All the code in the unit
  • Create 1 or more Frames, then reposition based on current layout
    • Examples:
      • In TTabControl for phone
      • Side-by-side for Tablet

TMultiView

  • One super panel with multiple modesMultiView
  • Supported modes
    • PlatformDefault
    • Drawer
    • NavigationPane
    • Panel
    • Popover
    • Custom
  • Point to MasterPane, DetailPane and definable MasterButton
  • PlatformDefault adapts to platform and orientation
  • Custom supports user defined layout and behavior

转载于:https://www.cnblogs.com/leamanXZ/p/5177478.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值