Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="fontName"></param>
 /// <param name="fontFile"></param>
 /// <param name="fontSize"></param>
 /// <param name="fontStyle"></param>
 /// <param name="textHAlignment"></param>
 /// <param name="textVAlignment"></param>
 /// <returns></returns>
 public static TextStyle Create(
     string name                   = "",
     string fontName               = "Calibri",
     string fontFile               = "calibri.ttf",
     double fontSize               = 12.0,
     FontStyle fontStyle           = null,
     TextHAlignment textHAlignment = TextHAlignment.Center,
     TextVAlignment textVAlignment = TextVAlignment.Center)
 {
     return(new TextStyle()
     {
         Name = name,
         FontName = fontName,
         FontFile = fontFile,
         FontSize = fontSize,
         FontStyle = fontStyle ?? FontStyle.Create(FontStyleFlags.Regular),
         TextHAlignment = textHAlignment,
         TextVAlignment = textVAlignment
     });
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new <see cref="TextStyle"/> instance.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="fontName"></param>
 /// <param name="fontFile"></param>
 /// <param name="fontSize"></param>
 /// <param name="fontStyle"></param>
 /// <param name="textHAlignment"></param>
 /// <param name="textVAlignment"></param>
 /// <returns></returns>
 public static TextStyle Create(
     string name = "",
     string fontName = "Calibri",
     string fontFile = "calibri.ttf",
     double fontSize = 12.0,
     FontStyle fontStyle = null,
     TextHAlignment textHAlignment = TextHAlignment.Center,
     TextVAlignment textVAlignment = TextVAlignment.Center)
 {
     return new TextStyle()
     {
         Name = name,
         FontName = fontName,
         FontFile = fontFile,
         FontSize = fontSize,
         FontStyle = fontStyle ?? FontStyle.Create(FontStyleFlags.Regular),
         TextHAlignment = textHAlignment,
         TextVAlignment = textVAlignment
     };
 }
Ejemplo n.º 3
0
        private void setTextBoxHAlignment(TextHAlignment alignment)
        {
            if (m_InternalTextBox == null)
            {
                return;
            }

            switch (alignment)
            {
            case TextHAlignment.LiteralLeft:
            {
                m_InternalTextBox.RightToLeft = RightToLeft.No;
                m_InternalTextBox.TextAlign   = HorizontalAlignment.Left;
                break;
            }

            case TextHAlignment.LiteralRight:
            {
                m_InternalTextBox.RightToLeft = RightToLeft.No;
                m_InternalTextBox.TextAlign   = HorizontalAlignment.Right;
                break;
            }

            case TextHAlignment.LiteralCenter:
            {
                m_InternalTextBox.RightToLeft = RightToLeft.No;
                m_InternalTextBox.TextAlign   = HorizontalAlignment.Center;
                break;
            }

            case TextHAlignment.Left:
            {
                m_InternalTextBox.RightToLeft = RightToLeft.Inherit;
                m_InternalTextBox.TextAlign   = HorizontalAlignment.Left;
                break;
            }

            case TextHAlignment.Right:
            {
                m_InternalTextBox.RightToLeft = RightToLeft.Inherit;
                m_InternalTextBox.TextAlign   = HorizontalAlignment.Right;
                break;
            }

            case TextHAlignment.Center:
            {
                m_InternalTextBox.RightToLeft = RightToLeft.Inherit;
                m_InternalTextBox.TextAlign   = HorizontalAlignment.Center;
                break;
            }

            default:    //controller
            {
                if (Field != null)
                {
                    setTextBoxHAlignment((TextHAlignment)Field.DisplayTextHAlignment);
                }
                break;
            }
            }
        }