/// <summary> /// 为WebBrowser所开线程的启动入口函数,相当于Winform里面的Main() /// </summary> /// <param name="_wp"></param> private static void StaRun(object _wp) { WebPreview wp = (WebPreview)_wp; try { WebPreviewBase wpb = new WebPreviewBase(wp._uri, wp._width, wp._height, wp._fullPage); wp._bitmap = wpb.GetWebPreview(); } catch (Exception ex) { wp._ex = ex; } }
/// <summary> /// 使用URI地址构造对象 /// </summary> /// <param name="uri">页面地址</param> /// <param name="size">页面位置(宽高)</param> /// <returns></returns> public static Bitmap GetWebPreview(Uri uri, Size size) { WebPreview wp = new WebPreview(uri, size); return(wp.GetWebPreview()); }
/// <summary> /// 根据相关参数获取页面预览位图对象 /// </summary> /// <param name="uri">页面地址</param> /// <param name="timeout">截图超时时间</param> /// <param name="width">图形宽度</param> /// <param name="height">图形高度</param> /// <param name="fullPage">全页面</param> /// <returns></returns> public static Bitmap GetWebPreview(Uri uri, int timeout, int width, int height, bool fullPage) { WebPreview wp = new WebPreview(uri, timeout, width, height, fullPage); return(wp.GetWebPreview()); }