Example #1
0
 private void fnScreenShot()
 {
     try
     {
         Screen[] screens = Screen.AllScreens;
         foreach (Screen screen in screens)
         {
             /// TamaƱo de la imagen
             int Width  = screen.Bounds.Width;
             int Height = screen.Bounds.Height;
             System.Drawing.Rectangle captureRectangle = screen.Bounds;
             Bitmap captureBitmap = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
             /// Capturando
             Graphics captureGraphics = Graphics.FromImage(captureBitmap);
             int      dedondeX        = captureRectangle.Left;
             int      dedondeY        = captureRectangle.Top;
             int      hastadondeX     = 0;
             int      hastadondeY     = 0;
             captureGraphics.CopyFromScreen(dedondeX, dedondeY, hastadondeX, hastadondeY, captureRectangle.Size);
             System.IO.MemoryStream stream = new System.IO.MemoryStream();
             captureBitmap.Save(stream, ImageFormat.Jpeg);
             /// Guardar la captura de pantalla en base de datos
             conexionBD cnn = new conexionBD();
             cnn.fnInsertaImagenBDD(stream.ToArray(), Int32.Parse(this.id_transaccion));
         }
     }
     catch (Exception ex)
     {
     }
 }