VB 2010 Web窗体.aspx中的屏幕截图 [英] Screen capture in vb 2010 web form .aspx

查看:94
本文介绍了VB 2010 Web窗体.aspx中的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以vb Web格式.aspx截取整个桌面屏幕.
我可以在互联网上找到表格的代码.
但不适用于网络表单.

我有什么指南可以用来以VB Web格式.aspx进行屏幕捕获吗?

解决方案

您不能这样做,而且没有惊讶为什么.

好吧,至少您不能在ASP.NET代码中执行此操作.您所有的ASP.NET代码都仅在服务器端运行,并生成了发送到浏览器的HTML.服务器看不到客户端计算机的屏幕.

另一个问题是,在用户浏览器中运行的任何代码都在受限的沙箱中运行,并且无法获取计算机资源,例如其文件系统,桌面,注册表等.这是出于安全原因.
有没有解决的办法??是的.您必须编写一个ActiveX控件,用户必须下载并安装该ActiveX控件,您的网页才能调用该控件为您获取屏幕截图.问题在于,并非每个平台都将运行ActiveX控件.您将仅限于Windows计算机.不,我没有例子.


现在您知道了为什么找不到任何ASP.NET代码来执行此操作...


查看此链接
屏幕截图应用程序 [ http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId = 309& lngWId = 10 [ 使用 System.Drawing.Imaging;



这是C#中的屏幕截图代码.

  int  screenWidth = Screen.GetBounds( Point( 0  0 )).Width;
 int  screenHeight = Screen.GetBounds(新建 Point( 0  0 )).高度;
位图bmpScreenShot = 位图(screenWidth,screenHeight);
图形gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen( 0  0  0  0  Size(screenWidth,screenHeight));
bmpScreenShot.Save(" ,ImageFormat.Jpeg); 


I am trying to do a screen capture of the entire desktop screen in vb web form .aspx.
I could find the code for form on the internet.
But not for web form.

Is there any guide that i can use to perform a screen capture in vb web form .aspx?

解决方案

You can''t do this and it''s no surprise why.

Well, at leat you cannot do this in your ASP.NET code. All of your ASP.NET code runs on the server-side only and generated the HTML that is sent to the browser. The server cannot see the screen of the client machines.

Another problem is that any code running in a users browser runs in a restricted sandbox and cannot get at the machine resources, such as its filesystem, desktop, registry, whatever. This is for security reasons.

Is there a way around this?? Yes. You''d have to write a ActiveX control that the user has to download and install that your web page can call to take the screenshot for you. The problem with this is that not every platform will run an ActiveX control. You''ll be limited to Windows machines only. No, I don''t have an example.


Now you know why you can''t find any ASP.NET code to do this...


see this links
Screen Shot Application[^]

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=309&lngWId=10[^]
Thanks
--RA


To create a screenshot in c# we need to use drawing api of the .net framework

First you have import System.Drawing.Imaging name space with following code...

using System.Drawing.Imaging;



here is the code in C# for screenshot.

 int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);


这篇关于VB 2010 Web窗体.aspx中的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆