利用Graphics的截图功能CopyFromScreen



该方式是直接对屏幕进行截图操作

UserControl chartContainPanel = new UserControl();
Graphics graph = chartContainPanel.CreateGraphics();
Size s = chartContainPanel.Size;
Bitmap memoryImage = new Bitmap(s.Width, s.Height, graph);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
Point screen = chartContainPanel.PointToScreen(this.Location);
// 拷贝屏幕对应区域为 memoryGraphics 的 BitMap  
memoryGraphics.CopyFromScreen(screen.X, screen.Y, 0, 0, s);
memoryImage.Save(fileName);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM