Description
The TextFlag.Top
field is a member of the TextFlag
enumeration in the Sandbox namespace. It is used to anchor text or other elements to the top of the Y axis. This flag can be combined with other TextFlag
values to achieve complex text alignment and positioning.
Usage
Use TextFlag.Top
when you want to align text or elements to the top of a container or area. This is particularly useful in UI design where vertical alignment is required. Combine it with other flags like TextFlag.Left
or TextFlag.Right
to achieve the desired horizontal alignment as well.
Example
// Example of using TextFlag.Top to align text to the top of a container
var textAlignment = TextFlag.Top | TextFlag.CenterHorizontally;
// Use this alignment in a text drawing function
Graphics.DrawText("Hello, World!", position, textAlignment);