Hello everyone . I am trying to get a part of a screenshot but unfortunately I am getting ArgumentException when I am creating Bitmap. Here's a code :
public Bitmap bp(int x, int y, int width, int height)
{
Bitmap bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(x, y, 0, 0, bitmap.Size, CopyPixelOperation.SourceCopy);
}
return bitmap;
}
When it's trying to make bitmap it throws ArgumentException. "Parameter isn't valid".
Can any one help to handle this ?
I Call this Function :
Bitmap ln = bp(Convert.ToInt32(textBox55.Text), Convert.ToInt32(textBox56.Text), Convert.ToInt32(textBox59.Text) - Convert.ToInt32(textBox55.Text), Convert.ToInt32(textBox56.Text) - Convert.ToInt32(textBox60.Text));
I am getting Parameters From TextBox