GDI+屏幕截图(directx、dxgi)
作者:互联网
GDI+ 、directx、dxgi => 我认为这就是一个东西,因为运行起来,硬件消耗特别低,直接代码:
private void button1_Click(object sender, EventArgs e)
{
System.Threading.Thread thread = new System.Threading.Thread(ThreadMethod);
thread.Start();
}
private void ThreadMethod()
{
Image bt = new System.Drawing.Bitmap(c.Bounds.Width, c.Bounds.Height);
Graphics g = Graphics.FromImage(bt);
try
{
for (int a = 0; a < 3000; a++)
{
g.CopyFromScreen(0, 0, 0, 0, c.Bounds.Size, CopyPixelOperation.SourceCopy);
// var i = copyscreen();
//pictureBox1.Image = bt;
Console.WriteLine(1);
System.Threading.Thread.Sleep(10);
}
g.Dispose();
}
catch (Exception _e)
{
g.Dispose();
System.Threading.Thread.CurrentThread.Abort();
}
}
Image copyscreen()
{
Image bt = new System.Drawing.Bitmap(c.Bounds.Width, c.Bounds.Height);
Graphics g = Graphics.FromImage(bt);
g.CopyFromScreen(0, 0, 0, 0, c.Bounds.Size, CopyPixelOperation.SourceCopy);
g.Save();
g.Dispose();
return bt;
}
标签:Thread,Bounds,System,bt,Threading,Graphics,GDI,dxgi,directx 来源: https://blog.csdn.net/liangyely/article/details/88833776