EvilZone
Programming and Scripting => .NET Framework => : bubzuru August 01, 2012, 11:22:31 PM
-
Save (full)Screen Shot To The Disk
//Save Screen Shot To Disk
public void SaveScreenShot(string path)
{
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpScreenshot.Save(path, System.Drawing.Imaging.ImageFormat.Png);
}
-
What libraries does Bitmap, Screen, Graphics, CopyPixelOperation and Imaging belong to?
-
What libraries does Bitmap, Screen, Graphics, CopyPixelOperation and Imaging belong to?
You mean namespaces within the BCL? System.Drawing. Seems weird that he is explicitly showing that within the code on only some of the objects within the namespace, and not all, or... not declaring that the namespace is being used at the top and avoiding the explicit declarations within the function...
No call to Dispose() either anywhere here, which isn't very good.