Coding Horror posted by:
Rajkatie | Posted on: 3/3/2012 | Category:
C# | Views: 1912 | Level:
Silver | Status:
[Member] |
Points: 75
|
Alert Moderator
try
{
using (Bitmap imageBmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Graphics.FromHwnd(IntPtr.Zero)))
{
using (Graphics graphics = Graphics.FromImage(imageBmp))
{
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, imageBmp.Size, CopyPixelOperation.SourceCopy);
imageBmp.Save("d:\\temp.jpeg",ImageFormat.Jpeg);
}
}
}
catch (Exception ex)
{
// log the exception
}
Rajesh Patel
MCP,MCTS,MCPD,MS
Brainbench (Asp.Net 4.0 and CSS 3.0)
Found interesting? Add this to: