Author Topic: (C#) Take ScreenShot  (Read 5775 times)

0 Members and 1 Guest are viewing this topic.

Offline bubzuru

  • Knight
  • **
  • Posts: 395
  • Cookies: 21
  • everything is contained in the data
    • View Profile
    • New School Tools
(C#) Take ScreenShot
« on: August 01, 2012, 11:22:31 pm »
Save (full)Screen Shot To The Disk

Code: (c#) [Select]
        //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);
        }
Damm it feels good to be gangsta
http://bubzuru.comule.com

Offline jyggorath

  • /dev/null
  • *
  • Posts: 8
  • Cookies: 2
    • View Profile
Re: (C#) Take ScreenShot
« Reply #1 on: December 03, 2013, 10:18:22 am »
What libraries does Bitmap, Screen, Graphics, CopyPixelOperation and Imaging belong to?

Offline ArkPhaze

  • Peasant
  • *
  • Posts: 136
  • Cookies: 20
  • null terminated
    • View Profile
Re: (C#) Take ScreenShot
« Reply #2 on: January 27, 2014, 03:51:52 am »
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.
« Last Edit: January 27, 2014, 03:52:15 am by ArkPhaze »
sig=: ArkPhaze

[ J/ASM/.NET/C/C++ - Software Engineer ]