0

i seen this tutorial of capture screen and i did some edit to it and the result is good,

but the resolution of each image is 1366, 768

enter image description here

and i want it to be like 683, 384

enter image description here

but all i get is part of the image

enter image description here

here is my code:

private void Display(Bitmap desktop)
{
    if (desktop != null)
    {
        Bitmap bmp = new Bitmap(1366, 768);
        using (Graphics g = Graphics.FromImage(bmp))
        {
            g.DrawImage(desktop, Point.Empty);
        }

        MemoryStream stream = new MemoryStream();
        Image myImg = (bmp as Image);
        myImg.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
        byte[] pic = stream.ToArray();

        ssWithMouseViewer.Image = myImg;
        dataGridView1.Rows.Add(pic);
    }
}

here is my form:

enter image description here

i want to store in the datagridview images with resolution of 683, 384 and less qualty.

Maged E William
  • 436
  • 2
  • 9
  • 27

1 Answers1

0

instead of g.DrawImage(desktop, Point.Empty); use g.DrawImage(desktop, 0, 0, bmp.Width, bmp.Height);

and create bitmap like Bitmap bmp = new Bitmap(683, 384);

x2.
  • 9,554
  • 6
  • 41
  • 62