コード例 #1
0
        /// <summary>
        /// 为WebBrowser所开线程的启动入口函数,相当于Winform里面的Main()
        /// </summary>
        /// <param name="_wp"></param>
        private static void StaRun(object _wp)
        {
            WebPreview wp = (WebPreview)_wp;

            try
            {
                if (wp._fix)
                {
                    using (WebPreviewBase wpb = new WebPreviewBase(wp._usingUrl, wp._parameter))
                    {
                        wp._bitmap = wpb.GetWebPreview();
                    }
                }
                else
                {
                    using (WebPreviewBase wpb = new WebPreviewBase(wp._usingUrl, wp._parameter, wp._width, wp._height, wp._screenWidth, wp._screenHeight))
                    {
                        wp._bitmap = wpb.GetWebPreview();
                    }
                }
            }
            catch (Exception ex)
            {
                wp._ex = ex;
            }
        }
コード例 #2
0
        /// <summary>
        /// 使用html源码制作无缩放的截图
        /// </summary>
        /// <param name="WebContent"></param>
        /// <returns></returns>
        public static byte[] GetWebFullPreviewByHtml(string WebContent)
        {
            WebPreview wp = new WebPreview(false, WebContent, true);

            return(wp.GetWebPreview());
        }
コード例 #3
0
        private bool _fix         = false; //是否截图为原始大小

        /// <summary>
        /// 使用url制作200*150的缩略图
        /// </summary>
        /// <param name="uri"></param>
        /// <returns></returns>
        public static byte[] GetWebPreview(string uri)
        {
            WebPreview wp = new WebPreview(true, uri, false);

            return(wp.GetWebPreview());
        }