Ejemplo n.º 1
0
        public static Image Snip(ScreenshotType type)
        {
            switch(type)
            {
                case ScreenshotType.FULL:
                    return CreateScreenshot(0, 0, SystemInformation.VirtualScreen.Width,SystemInformation.VirtualScreen.Height);

                case ScreenshotType.DEFINED:
                     SnippingTool snipper = new SnippingTool(CreateScreenshot(0, 0, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height), new Point(SystemInformation.VirtualScreen.Left, SystemInformation.VirtualScreen.Top));
                     if (snipper.ShowDialog() == DialogResult.OK)
                     {
                         return snipper.Image;
                     }
                     break;
                case ScreenshotType.ACTIVE:
                    RECT windowRectangle;
                    GetWindowRect((System.IntPtr)GetForegroundWindow(), out windowRectangle);
                    return CreateScreenshot(windowRectangle.Left, windowRectangle.Top, windowRectangle.Right - windowRectangle.Left, windowRectangle.Bottom - windowRectangle.Top);
            }
            return null;
        }
Ejemplo n.º 2
0
        public void NewScreenshot(SnippingTool.ScreenshotType type)
        {
            Image bmp = SnippingTool.Snip(type);

            if (bmp != null)
            {
                frm_main newFrmMain = new frm_main(bmp, pointTrayIcon);
                newFrmMain.ShowDialog();
            }
        }