• Api Documentation
  • Source Code
Search Results for

    Show / Hide Table of Contents
    • MewExtendedToolkit
      • AboutBox
      • AboutBoxExtensions
      • InputBox
      • ObservableValueExtensions
      • SharpAppProperties
      • TransformBox
      • TransformBoxExtensions
      • Wizard
      • WizardExtensions
      • WizardPage
      • WizardPageExtensions
    • MewExtendedToolkit.Html
      • ControlExtensions
      • HtmlContainer
      • HtmlControl
      • HtmlLabel
      • HtmlPanel

    Class HtmlContainer

    Low level handling of Html Renderer logic, this class is used by HtmlLabel and HtmlPanel.

    Inheritance
    object
    HtmlContainer
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: MewExtendedToolkit.Html
    Assembly: MewExtendedToolkit.Html.dll
    Syntax
    public sealed class HtmlContainer : IDisposable

    Constructors

    | Edit this page View Source

    HtmlContainer()

    Init.

    Declaration
    public HtmlContainer()

    Properties

    | Edit this page View Source

    ActualSize

    The actual size of the rendered html (after layout)

    Declaration
    public Size ActualSize { get; }
    Property Value
    Type Description
    Size
    | Edit this page View Source

    AvoidAsyncImagesLoading

    Gets or sets a value indicating if image asynchronous loading should be avoided (default - false).
    True - images are loaded synchronously during html parsing.
    False - images are loaded asynchronously to html parsing when downloaded from URL or loaded from disk.

    Declaration
    public bool AvoidAsyncImagesLoading { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Asynchronously image loading allows to unblock html rendering while image is downloaded or loaded from disk using IO ports to achieve better performance.
    Asynchronously image loading should be avoided when the full html content must be available during render, like render to image.

    | Edit this page View Source

    AvoidImagesLateLoading

    Gets or sets a value indicating if image loading only when visible should be avoided (default - false).
    True - images are loaded as soon as the html is parsed.
    False - images that are not visible because of scroll location are not loaded until they are scrolled to.

    Declaration
    public bool AvoidImagesLateLoading { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Images late loading improve performance if the page contains image outside the visible scroll area, especially if there is large amount of images, as all image loading is delayed (downloading and loading into memory).
    Late image loading may effect the layout and actual size as image without set size will not have actual size until they are loaded resulting in layout change during user scroll.
    Early image loading may also effect the layout if image without known size above the current scroll location are loaded as they will push the html elements down.

    | Edit this page View Source

    CssData

    the parsed stylesheet data used for handling the html

    Declaration
    public CssData CssData { get; }
    Property Value
    Type Description
    CssData
    | Edit this page View Source

    IsContextMenuEnabled

    Is the build-in context menu enabled and will be shown on mouse right click (default - true)

    Declaration
    public bool IsContextMenuEnabled { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsSelectionEnabled

    Is content selection is enabled for the rendered html (default - true).
    If set to 'false' the rendered html will be static only with ability to click on links.

    Declaration
    public bool IsSelectionEnabled { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Location

    The top-left most location of the rendered html.
    This will offset the top-left corner of the rendered html.

    Declaration
    public Point Location { get; set; }
    Property Value
    Type Description
    Point
    | Edit this page View Source

    MaxSize

    The max width and height of the rendered html.
    The max width will effect the html layout wrapping lines, resize images and tables where possible.
    The max height does NOT effect layout, but will not render outside it (clip).
    ActualSize can be exceed the max size by layout restrictions (unwrappable line, set image size, etc.).
    Set zero for unlimited (width\height separately).

    Declaration
    public Size MaxSize { get; set; }
    Property Value
    Type Description
    Size
    | Edit this page View Source

    ScrollOffset

    The scroll offset of the html.
    This will adjust the rendered html by the given offset so the content will be "scrolled".

    Declaration
    public Point ScrollOffset { get; set; }
    Property Value
    Type Description
    Point
    Examples

    Element that is rendered at location (50,100) with offset of (0,200) will not be rendered as it will be at -100 therefore outside the client Rect.

    | Edit this page View Source

    SelectedHtml

    Copy the currently selected html segment with style.

    Declaration
    public string SelectedHtml { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    SelectedText

    Get the currently selected text segment in the html.

    Declaration
    public string SelectedText { get; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    Clear()

    Clear the content of the HTML container releasing any resources used to render previously existing content.

    Declaration
    public void Clear()
    | Edit this page View Source

    ClearSelection()

    Clear the current selection.

    Declaration
    public void ClearSelection()
    | Edit this page View Source

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()
    | Edit this page View Source

    GetAttributeAt(Point, string)

    Get attribute value of element at the given x,y location by given key.
    If more than one element exist with the attribute at the location the inner most is returned.

    Declaration
    public string GetAttributeAt(Point location, string attribute)
    Parameters
    Type Name Description
    Point location

    the location to find the attribute at

    string attribute

    the attribute key to get value by

    Returns
    Type Description
    string

    found attribute value or null if not found

    | Edit this page View Source

    GetElementRectangle(string)

    Get the Rect of html element as calculated by html layout.
    Element if found by id (id attribute on the html element).
    Note: to get the screen Rect you need to adjust by the hosting control.

    Declaration
    public Rect? GetElementRectangle(string elementId)
    Parameters
    Type Name Description
    string elementId

    the id of the element to get its Rect

    Returns
    Type Description
    Rect?

    the Rect of the element or null if not found

    | Edit this page View Source

    GetHtml(HtmlGenerationStyle)

    Get html from the current DOM tree with style if requested.

    Declaration
    public string GetHtml(HtmlGenerationStyle styleGen = HtmlGenerationStyle.Inline)
    Parameters
    Type Name Description
    HtmlGenerationStyle styleGen

    Optional: controls the way styles are generated when html is generated (default: TheArtOfDev.HtmlRenderer.Core.Entities.HtmlGenerationStyle.Inline)

    Returns
    Type Description
    string

    generated html

    | Edit this page View Source

    GetLinkAt(Point)

    Get css link href at the given x,y location.

    Declaration
    public string GetLinkAt(Point location)
    Parameters
    Type Name Description
    Point location

    the location to find the link at

    Returns
    Type Description
    string

    css link href if exists or null

    | Edit this page View Source

    GetLinks()

    Get all the links in the HTML with the element Rect and href data.

    Declaration
    public List<LinkElementData<Rect>> GetLinks()
    Returns
    Type Description
    List<LinkElementData<Rect>>

    collection of all the links in the HTML

    | Edit this page View Source

    HandleKeyDown(Control, KeyEventArgs)

    Handle key down event for selection and copy.

    Declaration
    public void HandleKeyDown(Control parent, KeyEventArgs e)
    Parameters
    Type Name Description
    Control parent

    the control hosting the html to invalidate

    KeyEventArgs e

    the pressed key

    | Edit this page View Source

    HandleMouseDoubleClick(Control, MouseEventArgs)

    Handle mouse double click to select word under the mouse.

    Declaration
    public void HandleMouseDoubleClick(Control parent, MouseEventArgs e)
    Parameters
    Type Name Description
    Control parent

    the control hosting the html to set cursor and invalidate

    MouseEventArgs e

    mouse event args

    | Edit this page View Source

    HandleMouseDown(Control, MouseEventArgs)

    Handle mouse down to handle selection.

    Declaration
    public void HandleMouseDown(Control parent, MouseEventArgs e)
    Parameters
    Type Name Description
    Control parent

    the control hosting the html to invalidate

    MouseEventArgs e

    the mouse event args

    | Edit this page View Source

    HandleMouseLeave(Control)

    Handle mouse leave to handle hover cursor.

    Declaration
    public void HandleMouseLeave(Control parent)
    Parameters
    Type Name Description
    Control parent

    the control hosting the html to set cursor and invalidate

    | Edit this page View Source

    HandleMouseMove(Control, Point)

    Handle mouse move to handle hover cursor and text selection.

    Declaration
    public void HandleMouseMove(Control parent, Point mousePos)
    Parameters
    Type Name Description
    Control parent

    the control hosting the html to set cursor and invalidate

    Point mousePos

    the mouse event args

    | Edit this page View Source

    HandleMouseUp(Control, MouseEventArgs)

    Handle mouse up to handle selection and link click.

    Declaration
    public void HandleMouseUp(Control parent, MouseEventArgs e)
    Parameters
    Type Name Description
    Control parent

    the control hosting the html to invalidate

    MouseEventArgs e

    the mouse event args

    | Edit this page View Source

    PerformLayout()

    Measures the bounds of box and children, recursively.

    Declaration
    public void PerformLayout()
    | Edit this page View Source

    PerformPaint(IGraphicsContext, Rect)

    Render the html using the given device.

    Declaration
    public void PerformPaint(IGraphicsContext g, Rect clip)
    Parameters
    Type Name Description
    IGraphicsContext g

    the device to use to render

    Rect clip

    the clip rectangle of the html container

    | Edit this page View Source

    SetHtml(string, CssData?)

    Init with optional document and stylesheet.

    Declaration
    public void SetHtml(string htmlSource, CssData? baseCssData = null)
    Parameters
    Type Name Description
    string htmlSource

    the html to init with, init empty if not given

    CssData baseCssData

    optional: the stylesheet to init with, init default if not given

    Events

    | Edit this page View Source

    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.

    Declaration
    public event EventHandler<HtmlImageLoadEventArgs> ImageLoad
    Event Type
    Type Description
    EventHandler<HtmlImageLoadEventArgs>
    | Edit this page View Source

    LinkClicked

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

    Declaration
    public event EventHandler<HtmlLinkClickedEventArgs> LinkClicked
    Event Type
    Type Description
    EventHandler<HtmlLinkClickedEventArgs>
    | Edit this page View Source

    LoadComplete

    Raised when the set html document has been fully loaded.
    Allows manipulation of the html dom, scroll position, etc.

    Declaration
    public event EventHandler LoadComplete
    Event Type
    Type Description
    EventHandler
    | Edit this page View Source

    Refresh

    Raised when html renderer requires refresh of the control hosting (invalidation and re-layout).

    Declaration
    public event EventHandler<HtmlRefreshEventArgs> Refresh
    Event Type
    Type Description
    EventHandler<HtmlRefreshEventArgs>
    Remarks

    There is no guarantee that the event will be raised on the main thread, it can be raised on thread-pool thread.

    | Edit this page View Source

    RenderError

    Raised when an error occurred during html rendering.

    Declaration
    public event EventHandler<HtmlRenderErrorEventArgs> RenderError
    Event Type
    Type Description
    EventHandler<HtmlRenderErrorEventArgs>
    Remarks

    There is no guarantee that the event will be raised on the main thread, it can be raised on thread-pool thread.

    | Edit this page View Source

    ScrollChange

    Raised when Html Renderer request scroll to specific location.
    This can occur on document anchor click.

    Declaration
    public event EventHandler<HtmlScrollEventArgs> ScrollChange
    Event Type
    Type Description
    EventHandler<HtmlScrollEventArgs>
    | Edit this page View Source

    StylesheetLoad

    Raised when a 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.

    Declaration
    public event EventHandler<HtmlStylesheetLoadEventArgs> StylesheetLoad
    Event Type
    Type Description
    EventHandler<HtmlStylesheetLoadEventArgs>

    Implements

    IDisposable

    See Also

    HtmlContainerInt
    • Edit this page
    • View Source
    In this article
    Back to top Copyright (c) 2026 Jérémy Ansel