void HtmlToolTip_Draw(object sender, DrawToolTipEventArgs e) { e.Graphics.Clear(Color.White); if (container != null) { //Draw HTML! container.Paint(e.Graphics); } }
/// <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) { InitialContainer 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, System.Drawing.Drawing2D.CombineMode.Replace); }
/// <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) { InitialContainer 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, System.Drawing.Drawing2D.CombineMode.Replace); } }