The anchor akCenter
does not exist. But you can mimic akRelative
by setting the anchors property empty which results in relative movement of the control when the parent resizes. Combining that with centered placement will result in a centered-alike "anchor".
To center horizontally at designtime:
- In the IDE, choose the context menu of the control (right click),
- Position > Align > Horizontal > Center in Window,
- Set
Anchors.akLeft := False
, Anchors.akRight := False
in the object inspector,
- Et voilà :
akHorzCenter
.
The same goes for vertical, in which case you set akTop
and akBottom
false. To center in both directions: Anchors := []
.
Disclaimer: I have not found documentation of this anchors usage and I do not know whether this is the intended functioning, but it works very nice in D7 as well as in XE2.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…