HtmlRenderRenderToImageGdiPlus 方法 (String, Size, Size, TextRenderingHint, CssData, EventHandlerHtmlStylesheetLoadEventArgs, EventHandlerHtmlImageLoadEventArgs) |
Renders the specified HTML into a new image of unknown size that will be determined by min/max width/height and HTML layout.
If
maxSize.Width.Width is zero the html will use all the required width, otherwise it will perform line
wrap as specified in the html
If
maxSize.Height.Height is zero the html will use all the required height, otherwise it will clip at the
given max height not rendering the html below it.
If
minSize (Width/Height) is above zero the rendered image will not be smaller than the given min size.
The generated image have transparent background that the html is rendered on.
GDI+ text rending can be controlled by providing
TextRenderingHint.
See "Rendering to image" remarks section on
HtmlRender.
命名空间:
DSkin.Html
程序集:
DSkin (在 DSkin.dll 中) 版本:16.6.3.22
语法 public static Image RenderToImageGdiPlus(
string html,
Size minSize,
Size maxSize,
TextRenderingHint textRenderingHint = TextRenderingHint.AntiAlias,
CssData cssData = null,
EventHandler<HtmlStylesheetLoadEventArgs> stylesheetLoad = null,
EventHandler<HtmlImageLoadEventArgs> imageLoad = null
)
参数
- html
- 类型:SystemString
HTML source to render - minSize
- 类型:System.DrawingSize
optional: the min size of the rendered html (zero - not limit the width/height) - maxSize
- 类型:System.DrawingSize
optional: the max size of the rendered html, if not zero and html cannot be layout within the limit it will be clipped (zero - not limit the width/height) - textRenderingHint (Optional)
- 类型:System.Drawing.TextTextRenderingHint
optional: (default - SingleBitPerPixelGridFit) - 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
返回值
类型:
Imagethe generated image of the html
参见