Description
The CenterTop
field is a member of the TextFlag
enumeration in the Sandbox namespace. It is used to anchor text or other elements to the top side of a container while centering them horizontally. This flag is part of a set of flags that dictate the positioning of text and other elements within a graphical interface.
Usage
Use the CenterTop
flag when you want to position text or elements at the top of a container, with horizontal centering. This can be particularly useful in UI design where consistent alignment is necessary across different screen sizes or resolutions.
Combine CenterTop
with other TextFlag
values to achieve complex positioning. However, be cautious of combining conflicting flags, as this can lead to undefined behavior.
Example
// Example of using TextFlag.CenterTop
Graphics.DrawText("Hello, World!", new Vector2(100, 50), TextFlag.CenterTop);