public void CaptureScreen() { ScreenCapture Cap = new ScreenCapture(); Image src = Cap.CaptureAllScreen(); //Image src = Cap.CaptureMainScreen(); this.FormBorderStyle = FormBorderStyle.None; this.Width = src.Width - 1; this.Height = src.Height - 1; //this.Width = src.Width * 8 / 10 - 1; //this.Height = src.Height * 8 / 10 - 1; Screen.Image = src; }
private void RefreshTimer_Tick(object sender, EventArgs e) { Image MainScreen = Cap.CaptureAllScreen(); //Image MainScreen = Cap.CaptureMainScreen(); Image <Bgr, byte> MainSrc = new Image <Bgr, byte>((Bitmap)MainScreen); Mat CutScreen = new Mat(MainSrc.Mat, UserRect); //this.Size = CutScreen.Size; CvInvoke.Resize(CutScreen, CutScreen, Size.Empty, y, x, Inter.Area); this.Size = CutScreen.Size; DisplayPictureBox.Image = CutScreen.ToImage <Bgr, byte>().ToBitmap(); GC.Collect(); }