C# 實現屏幕截屏


//屏幕寬
            int iWidth = Screen.PrimaryScreen.Bounds.Width;
            //屏幕高
            int iHeight = Screen.PrimaryScreen.Bounds.Height;
            //按照屏幕寬高創建位圖
            Image img = new Bitmap(iWidth, iHeight);
            //從一個繼承自Image類的對象中創建Graphics對象
            Graphics gc = Graphics.FromImage(img);
            //抓屏並拷貝到myimage里
            gc.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(iWidth, iHeight));
            //this.BackgroundImage = img;
            //保存位圖
            img.Save(@"C:\" + Guid.NewGuid().ToString() + ".jpg");


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM