Search Results for

    Show / Hide Table of Contents

    Class TextElement

    Inheritance
    Object
    TextElement
    Implements
    IElement
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: GTA.UI
    Assembly: ScriptHookVDotNet3.dll
    Syntax
    public class TextElement : IElement

    Constructors

    | Improve this Doc View Source

    TextElement(String, PointF, Single)

    Initializes a new instance of the TextElement class used for drawing text on the screen.

    Declaration
    public TextElement(string caption, PointF position, float scale)
    Parameters
    Type Name Description
    String caption

    The TextElement to draw.

    PointF position

    Set the Position on screen where to draw the TextElement.

    Single scale

    Sets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

    | Improve this Doc View Source

    TextElement(String, PointF, Single, Color)

    Initializes a new instance of the TextElement class used for drawing text on the screen.

    Declaration
    public TextElement(string caption, PointF position, float scale, Color color)
    Parameters
    Type Name Description
    String caption

    The TextElement to draw.

    PointF position

    Set the Position on screen where to draw the TextElement.

    Single scale

    Sets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

    Color color

    Set the Color used to draw the TextElement.

    | Improve this Doc View Source

    TextElement(String, PointF, Single, Color, Font)

    Initializes a new instance of the TextElement class used for drawing text on the screen.

    Declaration
    public TextElement(string caption, PointF position, float scale, Color color, Font font)
    Parameters
    Type Name Description
    String caption

    The TextElement to draw.

    PointF position

    Set the Position on screen where to draw the TextElement.

    Single scale

    Sets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

    Color color

    Set the Color used to draw the TextElement.

    Font font

    Sets the Font used when drawing the text.

    | Improve this Doc View Source

    TextElement(String, PointF, Single, Color, Font, Alignment)

    Initializes a new instance of the TextElement class used for drawing text on the screen.

    Declaration
    public TextElement(string caption, PointF position, float scale, Color color, Font font, Alignment alignment)
    Parameters
    Type Name Description
    String caption

    The TextElement to draw.

    PointF position

    Set the Position on screen where to draw the TextElement.

    Single scale

    Sets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

    Color color

    Set the Color used to draw the TextElement.

    Font font

    Sets the Font used when drawing the text.

    Alignment alignment

    Sets the Alignment used when drawing the text, Left,Center or Right.

    | Improve this Doc View Source

    TextElement(String, PointF, Single, Color, Font, Alignment, Boolean, Boolean)

    Initializes a new instance of the TextElement class used for drawing text on the screen.

    Declaration
    public TextElement(string caption, PointF position, float scale, Color color, Font font, Alignment alignment, bool shadow, bool outline)
    Parameters
    Type Name Description
    String caption

    The TextElement to draw.

    PointF position

    Set the Position on screen where to draw the TextElement.

    Single scale

    Sets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

    Color color

    Set the Color used to draw the TextElement.

    Font font

    Sets the Font used when drawing the text.

    Alignment alignment

    Sets the Alignment used when drawing the text, Left,Center or Right.

    Boolean shadow

    Sets whether or not to draw the TextElement with a Shadow effect.

    Boolean outline

    Sets whether or not to draw the TextElement with an Outline around the letters.

    | Improve this Doc View Source

    TextElement(String, PointF, Single, Color, Font, Alignment, Boolean, Boolean, Single)

    Initializes a new instance of the TextElement class used for drawing text on the screen.

    Declaration
    public TextElement(string caption, PointF position, float scale, Color color, Font font, Alignment alignment, bool shadow, bool outline, float wrapWidth)
    Parameters
    Type Name Description
    String caption

    The TextElement to draw.

    PointF position

    Set the Position on screen where to draw the TextElement.

    Single scale

    Sets a Scale used to increase of decrease the size of the TextElement, for no scaling use 1.0f.

    Color color

    Set the Color used to draw the TextElement.

    Font font

    Sets the Font used when drawing the text.

    Alignment alignment

    Sets the Alignment used when drawing the text, Left,Center or Right.

    Boolean shadow

    Sets whether or not to draw the TextElement with a Shadow effect.

    Boolean outline

    Sets whether or not to draw the TextElement with an Outline around the letters.

    Single wrapWidth

    Sets how many horizontal pixel to draw before wrapping the TextElement on the next line down.

    Properties

    | Improve this Doc View Source

    Alignment

    Gets or sets the alignment of this TextElement.

    Declaration
    public Alignment Alignment { get; set; }
    Property Value
    Type Description
    Alignment

    The alignment:Left, Center, Right Justify

    | Improve this Doc View Source

    Caption

    Gets or sets the text to draw in this TextElement.

    Declaration
    public string Caption { get; set; }
    Property Value
    Type Description
    String

    The caption.

    | Improve this Doc View Source

    Centered

    Gets or sets a value indicating whether the alignment of this TextElement is centered. See Alignment

    Declaration
    public bool Centered { get; set; }
    Property Value
    Type Description
    Boolean

    true if centered; otherwise, false.

    | Improve this Doc View Source

    Color

    Gets or sets the color of this TextElement.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type Description
    Color

    The color.

    | Improve this Doc View Source

    Enabled

    Gets or sets a value indicating whether this TextElement will be drawn.

    Declaration
    public bool Enabled { get; set; }
    Property Value
    Type Description
    Boolean

    true if enabled; otherwise, false.

    | Improve this Doc View Source

    Font

    Gets or sets the font of this TextElement.

    Declaration
    public Font Font { get; set; }
    Property Value
    Type Description
    Font

    The GTA Font use when drawing.

    | Improve this Doc View Source

    Outline

    Gets or sets a value indicating whether this TextElement is drawn with an outline.

    Declaration
    public bool Outline { get; set; }
    Property Value
    Type Description
    Boolean

    true if outline; otherwise, false.

    | Improve this Doc View Source

    Position

    Gets or sets the position of this TextElement.

    Declaration
    public PointF Position { get; set; }
    Property Value
    Type Description
    PointF

    The position scaled on a 1280*720 pixel base.

    Remarks

    If ScaledDraw is called, the position will be scaled by the width returned in ScaledWidth.

    | Improve this Doc View Source

    Scale

    Gets or sets the scale of this TextElement.

    Declaration
    public float Scale { get; set; }
    Property Value
    Type Description
    Single

    The scale usually a value between ~0.5 and 3.0, Default = 1.0

    | Improve this Doc View Source

    ScaledWidth

    Measures how many pixels in the horizontal axis this TextElement will use when drawn against a ScaledWidth pixel base

    Declaration
    public float ScaledWidth { get; }
    Property Value
    Type Description
    Single
    | Improve this Doc View Source

    Shadow

    Gets or sets a value indicating whether this TextElement is drawn with a shadow effect.

    Declaration
    public bool Shadow { get; set; }
    Property Value
    Type Description
    Boolean

    true if shadow; otherwise, false.

    | Improve this Doc View Source

    Width

    Measures how many pixels in the horizontal axis this TextElement will use when drawn against a 1280 pixel base

    Declaration
    public float Width { get; }
    Property Value
    Type Description
    Single
    | Improve this Doc View Source

    WrapWidth

    Gets or sets the maximum size of the TextElement before it wraps to a new line.

    Declaration
    public float WrapWidth { get; set; }
    Property Value
    Type Description
    Single

    The width of the TextElement.

    Methods

    | Improve this Doc View Source

    Draw()

    Draws the TextElement this frame.

    Declaration
    public virtual void Draw()
    | Improve this Doc View Source

    Draw(SizeF)

    Draws the TextElement this frame at the specified offset.

    Declaration
    public virtual void Draw(SizeF offset)
    Parameters
    Type Name Description
    SizeF offset

    The offset to shift the draw position of this TextElement using a 1280*720 pixel base.

    | Improve this Doc View Source

    Finalize()

    Declaration
    protected void Finalize()
    | Improve this Doc View Source

    GetScaledStringWidth(String, Font, Single)

    Measures how many pixels in the horizontal axis the string will use when drawn

    Declaration
    public static float GetScaledStringWidth(string text, Font font = Font.ChaletLondon, float scale = 1F)
    Parameters
    Type Name Description
    String text

    The string of text to measure.

    Font font

    The Font of the textu to measure.

    Single scale

    Sets a sclae value for increasing or decreasing the size of the text, default value 1.0f - no scaling.

    Returns
    Type Description
    Single

    The amount of pixels scaled by the pixel width base return in ScaledWidth

    | Improve this Doc View Source

    GetStringWidth(String, Font, Single)

    Measures how many pixels in the horizontal axis the string will use when drawn

    Declaration
    public static float GetStringWidth(string text, Font font = Font.ChaletLondon, float scale = 1F)
    Parameters
    Type Name Description
    String text

    The string of text to measure.

    Font font

    The Font of the textu to measure.

    Single scale

    Sets a sclae value for increasing or decreasing the size of the text, default value 1.0f - no scaling.

    Returns
    Type Description
    Single

    The amount of pixels scaled on a 1280 pixel width base

    | Improve this Doc View Source

    ScaledDraw()

    Draws the TextElement this frame using the width returned in ScaledWidth.

    Declaration
    public virtual void ScaledDraw()
    | Improve this Doc View Source

    ScaledDraw(SizeF)

    Draws the TextElement this frame at the specified offset using the width returned in ScaledWidth.

    Declaration
    public virtual void ScaledDraw(SizeF offset)
    Parameters
    Type Name Description
    SizeF offset

    The offset to shift the draw position of this TextElement using a ScaledWidth*720 pixel base.

    Implements

    IElement
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX