标签:
FireMonkey has many layout controls to choose from. Come learn the differences and how to use them to create dynamic, multi-platform user interfaces.
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.
The AbsoluteToLocal and LocalToAbsolute for TScaledLayout don’t handle the scaling. I’ve created a class helper that adds new methods for dealing with scaling.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
{ TScaledLayoutHelper - interface } type TScaledLayoutHelper = class helper for TScaledLayout function LocalToAbsoluteScaled( const Point: TPointF): TPointF; function AbsoluteToLocalScaled( const Point: TPointF): TPointF; end ; { TScaledLayoutHelper - implementation } function TScaledLayoutHelper . AbsoluteToLocalScaled( const Point: TPointF): TPointF; begin Result . X := Self . Position . X + Point . X * Self . Width / Self . OriginalWidth; Result . Y := Self . Position . Y + Point . Y * Self . Height / Self . OriginalHeight; end ; function TScaledLayoutHelper . LocalToAbsoluteScaled( const Point: TPointF): TPointF; begin Result . X := Point . X / Self . Width / Self . OriginalWidth - Self . Position . X; Result . Y := Point . Y / Self . Height / Self . OriginalHeight - Self . Position . Y; end ; |
If you look at the original implementations of AbsoluteToLocal and LocalToAbsoluteyou will see they have different execution paths and calculations based on private members, so there may be some circumstances where my new ones don’t work as expected. They did work in my tests, and I am open to feedback.
http://delphi.org/2015/12/skill-sprint-using-firemonkey-layouts/
标签:
原文地址:http://www.cnblogs.com/findumars/p/5957374.html