Пример #1
0
 /// <summary>
 /// Gets the height of the font in the specified units
 /// </summary>
 /// <returns></returns>
 public float GetEmHeight()
 {
     return(CssUtils.GetFontHeight(ActualFont));
 }
Пример #2
0
        /// <summary>
        /// Draw video title on top of the iframe if found.
        /// </summary>
        private void DrawTitle(Graphics g, Rectangle rect)
        {
            if (_videoTitle != null && _imageWord.Width > 40 && _imageWord.Height > 40)
            {
                var font = CssUtils.GetCachedFont("Arial", 9f, System.Drawing.FontStyle.Regular);
                g.FillRectangle(CssUtils.GetSolidBrush(System.Drawing.Color.FromArgb(160, 0, 0, 0)), rect.Left, rect.Top, rect.Width, CssUtils.GetFontHeight(font) + 7);

                using (var sf = new StringFormat(StringFormat.GenericTypographic))
                {
                    sf.FormatFlags = StringFormatFlags.NoWrap;
                    sf.Trimming    = StringTrimming.EllipsisCharacter;
                    var titleRect = new RectangleF(rect.Left + 3, rect.Top + 3, rect.Width - 6, rect.Height - 6);
                    g.DrawString(_videoTitle, font, Brushes.WhiteSmoke, titleRect, sf);
                }
            }
        }