开发者

take a photo to pc since a application c#? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I want to print all the screen with a button, and save it in any folder ( i know how to do it ) but i dont know how to take the photo ... and another thing, I want this program is HIDE and it works with a key for example f9 or f11 or any key, but i want this continue HIDE and worki开发者_Go百科ng, how to take the print pant? and how to work if it is hide?

thanks stackoverflow and partherns


You can use the below method to take the screenshot of a single window or the whole screen:

    public void WindowsScreenshot()
    {
        // Full
        Rectangle bounds = Screen.GetBounds(Point.Empty);
        using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
        {
            using (Graphics g = Graphics.FromImage(bitmap))
            {
                g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
            }
            bitmap.Save("test_full.jpg", ImageFormat.Jpeg);
        }

        // Window
        Rectangle bounds = this.Bounds;
        using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
        {
            using (Graphics g = Graphics.FromImage(bitmap))
            {
                g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
            }
            bitmap.Save("test_window.jpg", ImageFormat.Jpeg);
        }
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜