예제 #1
0
        public Bitmap GenerateScreenShot(int PageNo)
        {
            List <Window> baseline = Window.GetRunningWindows();

            string DynamicsURL = "dynamicsnav://{0}/{1}/{2}/runpage?page={3}";

            NavProcess.StartInfo = new ProcessStartInfo(String.Format(DynamicsURL,
                                                                      this.Server,
                                                                      this.Instance,
                                                                      this.Company,
                                                                      PageNo));
            NavProcess.Kill();
            NavProcess.Start();

            IntPtr h = IsNAVPageOpen(baseline);

            var rect = new User32.Rect();

            User32.GetWindowRect(h, ref rect);
            int      width    = rect.right - rect.left;
            int      height   = rect.bottom - rect.top;
            var      bmp      = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            Graphics graphics = Graphics.FromImage(bmp);

            graphics.CopyFromScreen(rect.left, rect.top, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);
            //p.Kill();
            return(bmp);
        }
예제 #2
0
        public Bitmap GenerateScreenShot(int PageNo)
        {
            List<Window> baseline = Window.GetRunningWindows();

            string DynamicsURL = "dynamicsnav://{0}/{1}/{2}/runpage?page={3}";

            NavProcess.StartInfo = new ProcessStartInfo(String.Format(DynamicsURL,
                                                             this.Server,
                                                             this.Instance,
                                                             this.Company,
                                                             PageNo));
            NavProcess.Kill();
            NavProcess.Start();

            IntPtr h = IsNAVPageOpen(baseline);

            var rect = new User32.Rect();
            User32.GetWindowRect(h, ref rect);
            int width = rect.right - rect.left;
            int height = rect.bottom - rect.top;
            var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            Graphics graphics = Graphics.FromImage(bmp);
            graphics.CopyFromScreen(rect.left, rect.top, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);
            //p.Kill();
            return bmp;
        }