欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

c#不使用系統(tǒng)api實(shí)現(xiàn)可以指定區(qū)域屏幕截屏功能

 更新時(shí)間:2014年01月13日 09:08:38   作者:  
這篇文章主要介紹了不使用系統(tǒng)API通過純c#實(shí)現(xiàn)屏幕指定區(qū)域截屏功能,截屏后還可以保存圖象文件,大家參考使用吧

復(fù)制代碼 代碼如下:

//截取全屏圖象
        private void btnFullScreen_Click(object sender, EventArgs e)
        {
            //創(chuàng)建圖象,保存將來截取的圖象
            Bitmap image = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Graphics imgGraphics = Graphics.FromImage(image);
            //設(shè)置截屏區(qū)域
            imgGraphics.CopyFromScreen(0, 0, 0, 0, new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
            //保存
            SaveImage(image);
        }

//保存圖象文件
        private void SaveImage(Image image)
        {
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string fileName = saveFileDialog.FileName;
                string extension = Path.GetExtension(fileName);
                if (extension == ".jpg")
                {
                    image.Save(fileName, ImageFormat.Jpeg);
                }
                else
                {
                    image.Save(fileName, ImageFormat.Bmp);
                }
            }
        }

相關(guān)文章

最新評(píng)論