HtmlLabel Control

HtmlRenderer.HtmlLabel
Extends System.Windows.Forms.Control

You can use it just as an HTML container control, just place the label on a form and feed the Text property with HTML code.
Using AutoSize and AutoSizeHeightOnly client can control how the html content effects the size of the label. Either case scrollbars are never shown and html content outside of client bounds will be cliped MaximumSize and MinimumSize with AutoSize can limit the max/min size of the control.
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 label control.

Properties

Methods

Events

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.

AutoSize

AutoSize = AutoSizeHeightOnly = false
The label size will not change by the html content. MaximumSize and MinimumSize are ignored.
AutoSize = true
The width and height is adjustable by the html content, the width will be longest line in the html, MaximumSize.Width will restrict it but it can be lower than that.
AutoSizeHeightOnly = true
The width of the label is set and will not change by the content, the height is adjustable by the html content with restrictions to the MaximumSize.Height and MinimumSize.Height values.

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.