c# - element rectangle -


I'm trying to copy the status of a PictureBox from the screen. My code looks like this:

Form1.cs:

  _recorder = New ScreenRecord (); _recorderkStartRecording (Picture Box 1, Picture Box 1. Rankangletoskrin (new Rectangle ());   

Skrinrakrd CC:

  class Skrinrakord {private Skrinbitmap Skimmap ; public void Initialising (picture box camera, rectangle Rikt) {scBitmap = new Skrinbitmap (cAM, Rikt); Cam.Image = scBitmap.GetBitmap ();}}   

Skrinbitmap. cs:

  class screenbitmap {personal image box camera box; personal rectangle camera location; abstract Vjnik Skrinbitmap (Piccrboks camera, rectangle Rikt) {camBox = cam; CamLocation = Rikt;} public bitmap GetBitmap () {bitmap Skrinbitmap = GetScreen (); return Skrinbitmap;} private bitmap GetScreen () {bitmap scBitmap = new Bitmap (cambox. Width, cambox.Height); graphics g = Grafikskfremimej (Skibetmap); G.CopyFromScreen (camLocation.X, camLocation.Y, 0, 0, new shapes (cambox.Width, cambox.Height)); return scBitmap;} }   

I'm getting a rectangle and then copying it from the screen, but such a Ap- pears that it is not working. If I tries the following code:

  g.CopyFromScreen (camLocation.X, 121, 0, 0, new shapes (cambox.Width, cambox.Height));   

Where 121 is a random number, it works (I get an image, the part I want but it works) , So y coordinate of the rectangle is wrong? Or I'm missing something ...

This is what you'll get behind the PictureBox , with the opacity move, you can easily move it to your code:

  // When you take ambiguity about capturing the screen and later restored it Do it Opacity = 0.0; Point first = pointtaskins (picture box 1. location); Bitmap bit = new bitmap (picture box 1. wide, picture box 1.high); Graphics G = Graphics. Frame Image (bit); G.CopyFromScreen (first.x, first .w, 0, 0, image box size); this. Convenience = 1.0; PictureBox1.Image = bit;   

You can test this code by creating a new WinForms project, an button and PictureBox , and the code Click the button 's click event handler.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -