首页 > Windows开发 > 详细

WINFORM中几句程序获取整个屏幕的图片及当前窗口的图片快照

时间:2014-07-03 09:53:44      阅读:332      评论:0      收藏:0      [点我收藏+]

  /// <summary>

        /// 获取整个屏幕的图片
        /// </summary>
        /// <returns></returns>
        public static Image GetScreenImage()
        {
            Image image = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Graphics g = Graphics.FromImage(image);

            g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.PrimaryScreen.Bounds.Size);

 

            return image;

        }

        public static Image GetWinformImage()
        {

            //获取当前屏幕的图像
             Bitmap b = new Bitmap(this.Width, this.Height);
             this.DrawToBitmap(b, new Rectangle(0, 0, this.Width, this.Height));
             //b.Save(yourFileName);

             return b;

         }

WINFORM中几句程序获取整个屏幕的图片及当前窗口的图片快照,布布扣,bubuko.com

WINFORM中几句程序获取整个屏幕的图片及当前窗口的图片快照

原文:http://www.cnblogs.com/liuruitao/p/3818304.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!