/// <summary> /// Sets the horizontal text formatting to be used from now onwards. /// </summary> /// <param name="format"> /// Specifies the formatting to use. Currently can only be one of the /// following HorizontalTextFormatting values: /// - HTF_LEFT_ALIGNED (default) /// - HTF_RIGHT_ALIGNED /// - HTF_CENTRE_ALIGNED /// </param> public void SetTextFormatting(HorizontalTextFormatting format) { if (IsUnsupportedFormat(format)) { throw new InvalidRequestException( "currently only HTF_LEFT_ALIGNED, HTF_RIGHT_ALIGNED and HTF_CENTRE_ALIGNED are accepted for Editbox formatting"); } _textFormatting = format; Window.Invalidate(false); }
/// <summary> /// Set the horizontal formatting required for the text. /// </summary> /// <param name="value"></param> public void SetHorizontalFormatting(HorizontalTextFormatting value) { if (value == _horzFormatting) { return; } _horzFormatting = value; SetupStringFormatter(); ConfigureScrollbars(); Window.Invalidate(false); }
private static bool IsUnsupportedFormat(HorizontalTextFormatting format) { return(!(format == HorizontalTextFormatting.LeftAligned || format == HorizontalTextFormatting.RightAligned || format == HorizontalTextFormatting.CentreAligned)); }
/// <summary> /// Set the horizontal formatting setting for this TextComponent. /// </summary> /// <param name="fmt"> /// One of the HorizontalTextFormatting enumerated values. /// </param> public void SetHorizontalFormatting(HorizontalTextFormatting fmt) { _horzFormatting.Set(fmt); }