I got two different screenshot result on different screen resolution, First I try with 1920*1080(which was my pc default resolution) got zoomed not desired result and later I tried with changing my pc resolution 1280*720 and this time works fine. Here is my sample code:
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Width);
using (Graphics G = Graphics.FromImage(bmp))
{
G.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
G.CopyFromScreen(this.PointToScreen(new Point(0, 0)), new Point(0, 0), ClientSize);
double percent = 0.60;
Color darken = Color.FromArgb((int)(255 * percent), Color.Black);
using (Brush brsh = new SolidBrush(darken))
{
G.FillRectangle(brsh, this.ClientRectangle);
}
}
saveDialog.FileName = "test";
saveDialog.DefaultExt = "jpg";
saveDialog.Filter = "JPG images (*.jpg)|*.jpg";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
var fileName = saveDialog.FileName;
if (!System.IO.Path.HasExtension(fileName) || System.IO.Path.GetExtension(fileName) != "jpg")
fileName = fileName + ".jpg";
bmp.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
Image captured on 1920*1080 resolution: zoomed image
Image captured on 1280*720 resolution: Fine image
How screen resolution affects capturing screenshot? How can I get desired result on my pc default resolution(1920*180)? Please help. Thanks.