分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程
HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成
HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子
|
截图就不用Api了吧? 我一般用这个 [C#] 纯文本查看 复制代码 public Bitmap ScreenShot()
{
//截屏
var totalWidth = Screen.PrimaryScreen.Bounds.Width;
//.AllScreens.Select(p => p.Bounds.Width).Aggregate((a, b) => a + b);//注释的这两句可以一次性截所有屏幕
var totalHeight = Screen.PrimaryScreen.Bounds.Height;
//.AllScreens.Select(p => p.Bounds.Height).Aggregate((a, b) => a + b);
var img = new Bitmap(totalWidth, totalHeight);
var grap = Graphics.FromImage(img);
try
{
//这句就是截图的核心
grap.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(totalWidth, totalHeight));
grap.Dispose();
var snap = img.GetThumbnailImage(1024, 768, () => false, IntPtr.Zero);
using (var ms = new MemoryStream())
{
snap.Save(ms, ImageFormat.Jpeg);
sysInfo.ScreenSnapshot = Convert.ToBase64String(ms.ToArray());
}
img.Dispose();
}
catch (Exception ex)
{
grap.FillRectangle(new SolidBrush(Color.White), 0, 0, totalWidth, totalHeight);
var font = new Font("宋体", 16, (FontStyle.Regular));
var brush = Brushes.Blue;
grap.DrawString(ex.ToString(), font, brush, 2, 2);
using (var ms = new MemoryStream())
{
img.Save(ms, ImageFormat.Jpeg);
sysInfo.ScreenSnapshot = Convert.ToBase64String(ms.ToArray());
}
}
finally
{
img.Dispose();
grap.Dispose();
}
} |
937658938 发表于 2014-6-18 20:53 调用返回就可以了 |
| 表示不会使用有点看不懂。。。。 |
膜拜中…… |
| 我只是路过看看的。 |
如有修改,麻烦回传一份,谢谢 |