zl程序教程

您现在的位置是:首页 >  其它

当前栏目

屏幕截图

屏幕 截图
2023-09-14 08:58:58 时间

实现效果:

  

知识运用:

  Graphics类的CopyFromScreen方法  //该方法用于执行颜色数据(对应于由像素组成的矩形)从屏幕到Graphics的绘图画面的为块传输

  public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize);

  

 

实现代码:

        private Bitmap CaptureNoCursor()
        {
            Bitmap bmap = new Bitmap(Screen.GetWorkingArea(this).Width,Screen.GetWorkingArea(this).Height);
            using(Graphics g=Graphics.FromImage(bmap))
            {
             g.CopyFromScreen(0,0,0,0,bmap.Size);
            }
            return bmap;
        }