C# 클래스 LayoutFarm.Demo.HtmlPanel

Provides HTML rendering using the text property.
WinForms control that will render html content in it's client rectangle.
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/vertical) allowing to scroll the content.
If AutoScroll is false html content outside the client bounds will be clipped.
The control will handle mouse and keyboard events on it to support html text selection, copy-paste and mouse clicks.

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.

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 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.

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 occurred during html rendering.

상속: System.Windows.Forms.ScrollableControl
파일 보기 프로젝트 열기: prepare/HTML-Renderer 1 사용 예제들

Private Properties

프로퍼티 타입 설명
BuildCssBoxTree void
CreateMouseEventArg LayoutFarm.UI.UIMouseEventArgs
GetDC IntPtr
GetSharedPainter PaintVisitor
GetUIMouseButton LayoutFarm.UI.UIMouseButtons
OnRefresh void
OnScrollChange void
PaintMe void
PaintMe void
PerformHtmlLayout void
ReleaseDC IntPtr
ReleaseSharedPainter void
SetHtml void
UpdateScroll void
myHtmlContainer_NeedUpdateDom void

공개 메소드들

메소드 설명
ForceRefreshHtmlDomChange ( LayoutFarm doc ) : void
GetHtml ( ) : string

Get html from the current DOM tree with inline style.

GetHtmlContainer ( ) : HtmlContainer
HtmlPanel ( PixelFarm p, int w, int h ) : System

Creates a new HtmlPanel and sets a basic css for it's styling.

LoadHtmlDom ( LayoutFarm doc, string defaultCss ) : void
SetHtmlHost ( HtmlHost htmlhost ) : void

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Release the html container resources.

IsInputKey ( Keys keyData ) : bool

Used to add arrow keys to the handled keys in OnKeyDown.

OnClick ( EventArgs e ) : void

Set focus on the control for keyboard scrrollbars handling.

OnKeyDown ( KeyEventArgs e ) : void

Handle key down event for selection, copy and scrollbars handling.

OnLayout ( LayoutEventArgs levent ) : void

Perform the layout of the html in the control.

OnMouseDown ( MouseEventArgs e ) : void

Handle mouse down to handle selection.

OnMouseLeave ( EventArgs e ) : void

Handle mouse leave to handle cursor change.

OnMouseMove ( MouseEventArgs e ) : void

Handle mouse move to handle hover cursor and text selection.

OnMouseUp ( MouseEventArgs e ) : void

Handle mouse up to handle selection and link click.

OnPaint ( PaintEventArgs e ) : void

Perform paint of the html in the control.

비공개 메소드들

메소드 설명
BuildCssBoxTree ( MyHtmlContainer htmlCont, CssActiveSheet cssData ) : void
CreateMouseEventArg ( MouseEventArgs e ) : LayoutFarm.UI.UIMouseEventArgs
GetDC ( IntPtr hWnd ) : IntPtr
GetSharedPainter ( LayoutFarm htmlCont, PixelFarm canvas ) : PaintVisitor
GetUIMouseButton ( MouseButtons mouseButton ) : LayoutFarm.UI.UIMouseButtons
OnRefresh ( object sender, EventArgs e ) : void

Handle html renderer invalidate and re-layout as requested.

OnScrollChange ( object sender, HtmlScrollEventArgs e ) : void

On html renderer scroll request adjust the scrolling of the panel to the requested location.

PaintMe ( ) : void
PaintMe ( PaintEventArgs e ) : void
PerformHtmlLayout ( ) : void

Perform html container layout by the current panel client size.

ReleaseDC ( IntPtr hWnd, IntPtr hdc ) : IntPtr
ReleaseSharedPainter ( PaintVisitor p ) : void
SetHtml ( LayoutFarm htmlContainer, string html, CssActiveSheet cssData ) : void
UpdateScroll ( Point location ) : void

Adjust the scrolling of the panel to the requested location.

myHtmlContainer_NeedUpdateDom ( object sender, EventArgs e ) : void

메소드 상세

Dispose() 보호된 메소드

Release the html container resources.
protected Dispose ( bool disposing ) : void
disposing bool
리턴 void

ForceRefreshHtmlDomChange() 공개 메소드

public ForceRefreshHtmlDomChange ( LayoutFarm doc ) : void
doc LayoutFarm
리턴 void

GetHtml() 공개 메소드

Get html from the current DOM tree with inline style.
public GetHtml ( ) : string
리턴 string

GetHtmlContainer() 공개 메소드

public GetHtmlContainer ( ) : HtmlContainer
리턴 HtmlContainer

HtmlPanel() 공개 메소드

Creates a new HtmlPanel and sets a basic css for it's styling.
public HtmlPanel ( PixelFarm p, int w, int h ) : System
p PixelFarm
w int
h int
리턴 System

IsInputKey() 보호된 메소드

Used to add arrow keys to the handled keys in OnKeyDown.
protected IsInputKey ( Keys keyData ) : bool
keyData Keys
리턴 bool

LoadHtmlDom() 공개 메소드

public LoadHtmlDom ( LayoutFarm doc, string defaultCss ) : void
doc LayoutFarm
defaultCss string
리턴 void

OnClick() 보호된 메소드

Set focus on the control for keyboard scrrollbars handling.
protected OnClick ( EventArgs e ) : void
e EventArgs
리턴 void

OnKeyDown() 보호된 메소드

Handle key down event for selection, copy and scrollbars handling.
protected OnKeyDown ( KeyEventArgs e ) : void
e KeyEventArgs
리턴 void

OnLayout() 보호된 메소드

Perform the layout of the html in the control.
protected OnLayout ( LayoutEventArgs levent ) : void
levent LayoutEventArgs
리턴 void

OnMouseDown() 보호된 메소드

Handle mouse down to handle selection.
protected OnMouseDown ( MouseEventArgs e ) : void
e MouseEventArgs
리턴 void

OnMouseLeave() 보호된 메소드

Handle mouse leave to handle cursor change.
protected OnMouseLeave ( EventArgs e ) : void
e EventArgs
리턴 void

OnMouseMove() 보호된 메소드

Handle mouse move to handle hover cursor and text selection.
protected OnMouseMove ( MouseEventArgs e ) : void
e MouseEventArgs
리턴 void

OnMouseUp() 보호된 메소드

Handle mouse up to handle selection and link click.
protected OnMouseUp ( MouseEventArgs e ) : void
e MouseEventArgs
리턴 void

OnPaint() 보호된 메소드

Perform paint of the html in the control.
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
리턴 void

SetHtmlHost() 공개 메소드

public SetHtmlHost ( HtmlHost htmlhost ) : void
htmlhost HtmlHost
리턴 void