C# 截取屏幕

2021-01-17 15:11

阅读:459

标签:turn   new   drawing   screen   returns   capture   from   name   bit   

/// 
/// 截取屏幕
/// 
/// 起点X坐标
/// 起点Y坐标
/// 截取宽度
/// 截取高度
/// 
private void CaptureScreen(double x, double y, double width, double height)
{
    int ix = Convert.ToInt32(x);
    int iy = Convert.ToInt32(y);
    int iw = Convert.ToInt32(width);
    int ih = Convert.ToInt32(height);

    System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(iw, ih);
    System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
    graphics.CopyFromScreen(ix, iy, 0, 0, new System.Drawing.Size(iw, ih));
    graphics.Dispose();
}

C# 截取屏幕

标签:turn   new   drawing   screen   returns   capture   from   name   bit   

原文地址:https://www.cnblogs.com/flamegreat/p/12195730.html


评论


亲,登录后才可以留言!