关于.net WebBrowser.DrawToBitmap方法去截图地图html页面不成功

平山CP3 2021-02-09 06:10:15
使用WebBrowser.DrawToBitmap,在winform的webbrowser去加载有地图的页面能加载出来,但是像地图页面截出来的图片却是空白的。

截图百度地图样例:
...全文
186 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
平山CP3 2021-02-09
  • 打赏
  • 举报
回复
引用 1 楼 以专业开发人员为伍的回复:
WebBrowser 控件有可能只是适用于最传统的 html element,例如 <img> 之类的。对于使用 canvas 或者 svg 画图的可能无效。你可以使用 WebBrowser 功能来返回具体的 <div> 的窗口坐标(x,y),然后调用 windows SDK 兼容的截屏功能来录制图片。使用更好的 web 控件,可以捕获的更好。
大神居然来回帖,感谢,那也就是webbrowser去画图有canvas这种html不太行是吗,可是在可视化窗口中也确实完全加载出来了,只是drawtobigmap时候绘不出来吗
  • 打赏
  • 举报
回复
WebBrowser 控件有可能只是适用于最传统的 html element,例如 <img> 之类的。对于使用 canvas 或者 svg 画图的可能无效。你可以使用 WebBrowser 功能来返回具体的 <div> 的窗口坐标(x,y),然后调用 windows SDK 兼容的截屏功能来录制图片。使用更好的 web 控件,可以捕获的更好。
Chrome based Browser Engine for .NET EO.WebBrowser is a web browser engine based on Google's Chromium project but with native .NET programming interface --- don't worry, it's not a wrapper around the Chrome browser installed on your machine. In fact EO.WebBrowser has the whole browser engine embedded inside a single .NET DLL. In another word, it has zero external dependency. Just reference and use. Why use EO.WebBrowser? • Based on Google's Chrome Project EO.WebBrowser uses the same core Google's Chrome and Apple Safari uses. It does not rely on IE. The engine is much faster and safer. • Zero External Dependency What if user updates/uninstall their browser? What if user disables JavaScript in Internet Explorer's settings dialog? These questions does not exist with EO.WebBrowser because everything is embedded inside our DLL files. • Native .NET components written in C# Because it's written in .NET, you can use it with any .NET based language/development tool. The same DLL works for both 32 bit and 64 bit environments; • Easy to use Programming Interface EO.WebBrowser offers core components that can be used in any Windows application, as well as wrapper controls for both Windows Forms applications and WPF applications; • Extensive Customization Options EO.WebBrowser offers extensive customization options that allow you to customize context menu, hot keys, JavaScript dialogs, file dialogs, focus and window control. Together these features allow you to seamlessly integrate the browser engine into your application; • .NET code -> JavaScript code Turn any web page into an integral part of your application -- both visually and programmatically. You can execute JavaScript code and access all the JavaScript objects directly from your .NET code. Access their properties or even call a JavaScript function are all different options available to you; • JavaScript code -> .NET code Things always go both ways --- and this is reflected in our programming interface as well. You can call JavaScript code from .NET code, and the other way around is also true --- you can call .NET code from your JavaScript code. This allows your Web page to seamlessly interact with the host application; • Custom Resource Handler Want to keep an eye on everything? Or want to keep everything to yourself? We got you covered. EO.WebBrowser offers ability to intercept and modify all requests that originate from the browser engine. For example, you can automatically deny all request sent to a specific host. It also offers you the ability to implement custom protocols or custom resource handlers. For example, you can implement a custom request handler to load images from your database instead of a Web server;

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧