C# winform 截屏代码

c#
2015-07-03 0 232
C# winform 截屏代码
       try
            {
                Image image = new Bitmap(width, height);
                Graphics g = Graphics.FromImage(image);

                g.CopyFromScreen(x, y, 0, 0, new System.Drawing.Size(width, height));     


                string hour = DateTime.Now.Minute.ToString();
                string second = DateTime.Now.Second.ToString();
                image.Save(ScreenshotPath + "\\" + hour + "_" + second + ".jpg");
            }
            catch 
            { 

            }



ScreenshotPath------------保存路径

 string hour = DateTime.Now.Minute.ToString();
string second = DateTime.Now.Second.ToString();------------------------取当前时间,作为文文件名

遇见资源网 c# C# winform 截屏代码 http://www.ox520.com/12797.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务