屏幕截图为黑色,而使用wcf以及Silverlight 4中的Handler保存在服务器上时. [英] Screenshot are black while saving on server using wcf as well as Handler in Silverlight 4.

查看:63
本文介绍了屏幕截图为黑色,而使用wcf以及Silverlight 4中的Handler保存在服务器上时.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;
提供解决此问题的解决方案,但我能够将屏幕截图保存在本地文件夹中.
我正在Silvelight 4中的处理程序和wcf服务中尝试以下代码.

HI Everybody;
Provide some solution for solving this problem but i am able to save screenshot on local folder.
I am trying with this below code in Silvelight 4 in handler and wcf service.

try
          {
              string filenamewithpath = string.Empty;
              filenamewithpath = HostingEnvironment.ApplicationPhysicalPath + "Images/Annotations/" + username + "/" + filename;

              string newDirectory = HostingEnvironment.ApplicationPhysicalPath + "Images/Annotations/" + username;
              this.CreateDirectoryIfNotExists(newDirectory);

              System.Drawing.Bitmap myImage = new System.Drawing.Bitmap(100, 100);
              //myImage.GetThumbnailImage(100, 100, null, new IntPtr());
              myImage = CaptureScreen.CaptureDesktopWithCursor(); //this is for getting screenshot.
              myImage.Save(filenamewithpath, System.Drawing.Imaging.ImageFormat.Png);

              System.Windows.Forms.MessageBox.Show("File Saved as " + filenamewithpath);
          }
          catch (Exception ex)
          {
              //this.ErrorLog(ex.Message);
          }

推荐答案

在Web应用程序中无法使用CaptureDesktopWithCursor方法.
Using CaptureDesktopWithCursor method it is not possible in the web application.


这篇关于屏幕截图为黑色,而使用wcf以及Silverlight 4中的Handler保存在服务器上时.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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