# HtmlRender Class

`HtmlRenderer.HtmlRender`

> `Static` class for direct html rendering, intendent for small html fragments.
> Prefer using WinForms Html controls: HtmlPanel or HtmlLabel.
> For direct non-trivial html rendering consider using HtmlContainer.

> Not suitable for large htmls as each render call will parse the given html string into DOM structure, for large html it can be very expensive.
> Consider using HtmlContainer for large html or for performance.

> // Measure the size (width and height) required to draw the given html under given width and height restrictions.
> `Measure(Graphics g, string html, float maxWidth = 0, float maxHeight = 0, CssData cssData = null)`
> // Measure the size (width and height) required to draw the given html under given width and height restrictions.
> `Measure(Graphics g, string html, float maxWidth, float maxHeight, CssData cssData, EventHandler<HtmlStylesheetLoadEventArgs> stylesheetLoad, EventHandler<HtmlImageLoadEventArgs> imageLoad)`
> // Renders the specified HTML source on the specified location and max size restriction.
> // If maxWidth is zero the html will use all the required width, otherwise it will perform line wrap as specified in the html
> // Returned is the actual widht and height of the rendered html.
> `Render(Graphics g, string html, float left = 0, float top = 0, float maxWidth = 0, CssData cssData = null)`
> // Renders the specified HTML source on the specified location and max size restriction.
> // If maxSize.Width is zero the html will use all the required width, otherwise it will perform line wrap as specified in the html
> // If maxSize.Height is zero the html will use all the required height, otherwise it will clip at the given max height not rendering the html below it.
> // Returned is the actual widht and height of the rendered html.
> `Render(Graphics g, string html, PointF location, SizeF maxSize, CssData cssData = null)`
> // Renders the specified HTML source on the specified location and max size restriction.
> // If maxSize.Width is zero the html will use all the required width, otherwise it will perform line wrap as specified in the html
> // If maxSize.Height is zero the html will use all the required height, otherwise it will clip at the given max height not rendering the html below it.
> // Returned is the actual widht and height of the rendered html.
> `Render(Graphics g, string html, PointF location, SizeF maxSize, CssData cssData, EventHandler<HtmlStylesheetLoadEventArgs> stylesheetLoad, EventHandler<HtmlImageLoadEventArgs> imageLoad)`