点击或拖拽改变大小

HtmlRenderRenderToImage 方法 (String, Size, Color, CssData, EventHandlerHtmlStylesheetLoadEventArgs, EventHandlerHtmlImageLoadEventArgs)

Renders the specified HTML into a new image of the requested size.
The HTML will be layout by the given size but will be clipped if cannot fit.

Limitation: The image cannot have transparent background, by default it will be white.
See "Rendering to image" remarks section on HtmlRender.

命名空间:  DSkin.Html
程序集:  DSkin (在 DSkin.dll 中) 版本:16.6.3.22
语法
C#
public static Image RenderToImage(
	string html,
	Size size,
	Color backgroundColor = null,
	CssData cssData = null,
	EventHandler<HtmlStylesheetLoadEventArgs> stylesheetLoad = null,
	EventHandler<HtmlImageLoadEventArgs> imageLoad = null
)

参数

html
类型:SystemString
HTML source to render
size
类型:System.DrawingSize
The size of the image to render into, layout html by width and clipped by height
backgroundColor (Optional)
类型:System.DrawingColor
optional: the color to fill the image with (default - white)
cssData (Optional)
类型:DSkin.Html.CoreCssData
optional: the style to use for html rendering (default - use W3 default style)
stylesheetLoad (Optional)
类型:SystemEventHandlerHtmlStylesheetLoadEventArgs
optional: can be used to overwrite stylesheet resolution logic
imageLoad (Optional)
类型:SystemEventHandlerHtmlImageLoadEventArgs
optional: can be used to overwrite image resolution logic

返回值

类型:Image
the generated image of the html
异常
异常条件
ArgumentOutOfRangeExceptionif backgroundColor is Transparent
参见