Description
The CenterVertically
field is a member of the TextFlag
enumeration in the Sandbox namespace. It is used to align text or other elements in the center along the Y axis. This flag can be combined with other TextFlag
values to achieve the desired text alignment.
Usage
Use the CenterVertically
flag when you want to center text vertically within a given area. This can be particularly useful in UI design where text needs to be aligned in the middle of a container or element.
To use this flag, combine it with other TextFlag
values using the bitwise OR operator if needed. For example, you can combine it with CenterHorizontally
to center text both vertically and horizontally.
Example
// Example of using TextFlag.CenterVertically
Graphics.DrawText("Hello, World!", new Vector2(100, 100), TextFlag.CenterVertically | TextFlag.CenterHorizontally);