# HtmlPanel Control

`HtmlRenderer.HtmlPanel`
Extends `System.Windows.Forms.ScrollableControl`

> You can use it just as an HTML container control, just place the panel on a form and feed the `Text` property with HTML code.
> If AutoScroll is true and the layout of the html resulted in its content beyond the client bounds of the panel it will show scrollbars (horizontal/verticle) allowing to scroll the content.
> If AutoScroll is false html content outside the client bounds will be cliped.
> The control will handle mouse and keyboard events on it to support html text selection, copy-paste and mouse clicks.
> Try the Sample Form to play with html panel control.

> ## Properties

> - IsSelectionEnabled - Is content selection is enabled for the rendered html (default - true).
> - IsContextMenuEnabled - Is the build-in context menu enabled and will be shown on mouse right click (default - true).
> - BaseStylesheet - Set base stylesheet to be used by html rendered in the panel.
> - AutoScroll - Gives the panel scroll bars when content needs it.
> - Text - Gets or sets the HTML source for rendering.

> ## Methods

> - GetHtml() - Get html from the current DOM tree with inline style.

> ## Events

> - LinkClicked - Raised when the user clicks on a link in the html, Allows canceling the execution of the link.
> - RenderError - Raised when an error occured during html rendering.
> - StylesheetLoad - Raised when aa stylesheet is about to be loaded by file path or URI by link element. This event allows to provide the stylesheet manually or provide new source (file or uri) to load from.
> - ImageLoad - Raised when an image is about to be loaded by file path or URI. This event allows to provide the image manually, if not handled the image will be loaded from file or download from URI.

> # Remarks

> ### Differences between HtmlPanel and HtmlLabel

> The major differential to use HtmlPanel or HtmlLabel is size and scrollbars.
> If the size of the control depends on the html content the HtmlLabel should be used.
> If the size is set by some kind of layout then HtmlPanel is more suitable, also shows scrollbars if the html contents is larger than the control client rectangle.
> - HtmlPanel has scrollbars support
> - HtmlLabel can be autosized
> - HtmlLabel can have transparent background

> ### AutoScroll

> Allows showing scrollbars if html content is placed outside the visible boundaries of the panel.

> ### LinkClicked event

> Raised when the user clicks on a link in the html.
> Allows canceling the execution of the link.

> ### StylesheetLoad event

> Raised when aa stylesheet is about to be loaded by file path or URI by link element.
> This event allows to provide the stylesheet manually or provide new source (file or uri) to load from.
> If no alternative data is provided the original source will be used.

> ### ImageLoad event

> Raised when an image is about to be loaded by file path or URI.
> This event allows to provide the image manually, if not handled the image will be loaded from file or download from URI.

> ### RenderError event

> Raised when an error occured during html rendering.