Пример #1
0
        private void HtmlToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            e.Graphics.Clear(Color.White);

            if (container != null)
            {
                //Draw HTML!
                container.Paint(e.Graphics);
            }
        }
Пример #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (!(this is HtmlLabel))
            {
                e.Graphics.Clear(SystemColors.Window);
            }


            htmlContainer.ScrollOffset   = AutoScrollPosition;
            e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            htmlContainer.Paint(e.Graphics);
        }
Пример #3
0
        /// <summary>
        /// Renders the specified HTML source on the specified area clipping if specified
        /// </summary>
        /// <param name="g">Device to draw</param>
        /// <param name="html">HTML source</param>
        /// <param name="area">Area where HTML should be drawn</param>
        /// <param name="clip">If true, it will only paint on the specified area</param>
        public static void Render(Graphics g, string html, RectangleF area, bool clip)
        {
            var    container = new InitialContainer(html);
            Region prevClip  = g.Clip;

            if (clip)
            {
                g.SetClip(area);
            }

            container.SetBounds(area);
            container.MeasureBounds(g);
            container.Paint(g);

            if (clip)
            {
                g.SetClip(prevClip, CombineMode.Replace);
            }
        }