Exemple #1
0
        ///<summary>
        /// Reads font attributes from <see cref="styles" /> and update <see cref="c" />
        ///</summary>
        ///<param name="c">Control to update</param>
        ///<param name="styles">Instance of <see cref="HtmlStyleReader"/></param>
        public static void ReadFontAttributes([NotNull] Control c, [NotNull] HtmlStyleReader styles)
        {
            var size = styles[HtmlStyleAttribute.FontSize];
            var u    = size.EndsWith("pt") ? GraphicsUnit.Point : GraphicsUnit.Pixel;
            var fs   = FontStyle.Regular;

            if (styles[HtmlStyleAttribute.FontWeight] == "bold")
            {
                fs |= FontStyle.Bold;
            }
            if (styles[HtmlStyleAttribute.FontStyle] == "italic")
            {
                fs |= FontStyle.Italic;
            }
            size   = size.Remove(size.Length - 2);
            c.Font = new Font(styles[HtmlStyleAttribute.FontFamily], float.Parse(size), fs, u);
        }
Exemple #2
0
 ///<summary>
 /// Reads size attributes from <see cref="styles" /> and update <see cref="c" />
 ///</summary>
 ///<param name="c">Control to update</param>
 ///<param name="styles">Instance of <see cref="HtmlStyleReader"/></param>
 public static void ReadSizeAttributes([NotNull] Control c, [NotNull] HtmlStyleReader styles)
 {
     c.Size = new Size(int.Parse(styles[HtmlStyleAttribute.Width]), int.Parse(styles[HtmlStyleAttribute.Height]));
 }
Exemple #3
0
 ///<summary>
 /// Reads positions attributes from <see cref="styles" /> and update <see cref="c" />
 ///</summary>
 ///<param name="c">Control to update</param>
 ///<param name="styles">Instance of <see cref="HtmlStyleReader"/></param>
 public static void ReadPositionAttributes([NotNull] Control c, [NotNull] HtmlStyleReader styles)
 {
     c.Location = new Point(int.Parse(styles[HtmlStyleAttribute.Left]), int.Parse(styles[HtmlStyleAttribute.Top]));
 }