Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to take a screen shot?

How to take a screen shot?

Scheduled Pinned Locked Moved C#
tutorialquestion
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hussam Fattahi
    wrote on last edited by
    #1

    How to capture a screen shot, and then save it as JPEG format? Thanks in advance..

    M M 3 Replies Last reply
    0
    • H Hussam Fattahi

      How to capture a screen shot, and then save it as JPEG format? Thanks in advance..

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello,

      Hussam Fattahi wrote:

      How to capture a screen shot

      http://www.codeproject.com/script/comments/forums.asp?msg=1827909&forumid=1649&XtraIDs=1649&searchkw=ScreenShot&sd=22+Feb+2005&ed=23+May+2007&author=Martin%23&stype=1#xx1827909xx[^] Basically for .Net<2.0 you have to use API "gdi32.dll" method, for .Net>=2.0 you can use Graphics.CopyFromScreen() method.

      Hussam Fattahi wrote:

      and then save it as JPEG format

      The Bitmape has a "Save" method where you can define the Format. Hope it helps! All the best, Martin

      H 1 Reply Last reply
      0
      • H Hussam Fattahi

        How to capture a screen shot, and then save it as JPEG format? Thanks in advance..

        M Offline
        M Offline
        Muammar
        wrote on last edited by
        #3
          int screenWidth = Screen.GetBounds(new Point(0, 0)).Width; 
          int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
        
          Bitmap screenShot = new Bitmap(screenWidth, screenHeight);
        
          Graphics gfx = Graphics.FromImage((Image)screenShot);  
          gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));  
          
          screenShot.Save(@"C:\\YourScreenShot.jpg");
        

        Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

        H 1 Reply Last reply
        0
        • H Hussam Fattahi

          How to capture a screen shot, and then save it as JPEG format? Thanks in advance..

          M Offline
          M Offline
          Muammar
          wrote on last edited by
          #4

          By the way, what are you trying to do?? I saw your posts here in the forum since February and it looks like you're trying to develop some sort of a Trojan/ hacking application.. Just hopping we're helping in that:~


          Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

          H V 2 Replies Last reply
          0
          • M Muammar
              int screenWidth = Screen.GetBounds(new Point(0, 0)).Width; 
              int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
            
              Bitmap screenShot = new Bitmap(screenWidth, screenHeight);
            
              Graphics gfx = Graphics.FromImage((Image)screenShot);  
              gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));  
              
              screenShot.Save(@"C:\\YourScreenShot.jpg");
            

            Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

            H Offline
            H Offline
            Hussam Fattahi
            wrote on last edited by
            #5

            thanks, it works. but the size of image is still huge 1.5 Mb. i would like to be as usual JPEG image, in Kbytes. is there a way to do so.

            M 1 Reply Last reply
            0
            • M Muammar

              By the way, what are you trying to do?? I saw your posts here in the forum since February and it looks like you're trying to develop some sort of a Trojan/ hacking application.. Just hopping we're helping in that:~


              Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

              H Offline
              H Offline
              Hussam Fattahi
              wrote on last edited by
              #6

              i'm developing a client\server application, the application consist of two part 1- server control the clients log in to computers ( as internet cafe). 2- server monitor client (( what i hope for, is to do as Remote Administrator). it's for college, and since i'am a new programmer, i have a lot of difficalties .. thanks, any way .. please, excuse my bad english.

              M 1 Reply Last reply
              0
              • H Hussam Fattahi

                thanks, it works. but the size of image is still huge 1.5 Mb. i would like to be as usual JPEG image, in Kbytes. is there a way to do so.

                M Offline
                M Offline
                Martin 0
                wrote on last edited by
                #7

                Hello, Maybe you could try to use: System.Drawing.Imaging.ImageFormat.Png Format instead of JPEG It's amazing how good the quality is. Hope it helps! All the best, Martin

                1 Reply Last reply
                0
                • M Martin 0

                  Hello,

                  Hussam Fattahi wrote:

                  How to capture a screen shot

                  http://www.codeproject.com/script/comments/forums.asp?msg=1827909&forumid=1649&XtraIDs=1649&searchkw=ScreenShot&sd=22+Feb+2005&ed=23+May+2007&author=Martin%23&stype=1#xx1827909xx[^] Basically for .Net<2.0 you have to use API "gdi32.dll" method, for .Net>=2.0 you can use Graphics.CopyFromScreen() method.

                  Hussam Fattahi wrote:

                  and then save it as JPEG format

                  The Bitmape has a "Save" method where you can define the Format. Hope it helps! All the best, Martin

                  H Offline
                  H Offline
                  Hussam Fattahi
                  wrote on last edited by
                  #8

                  Thanks, matrin

                  1 Reply Last reply
                  0
                  • H Hussam Fattahi

                    i'm developing a client\server application, the application consist of two part 1- server control the clients log in to computers ( as internet cafe). 2- server monitor client (( what i hope for, is to do as Remote Administrator). it's for college, and since i'am a new programmer, i have a lot of difficalties .. thanks, any way .. please, excuse my bad english.

                    M Offline
                    M Offline
                    Muammar
                    wrote on last edited by
                    #9

                    Yes.. Sana'a university:sigh:.. I've been there too!! By the way, as Martin saied, try this:

                    screenShot.Save(@"C:\YourScreenShot.jpg", System.Drawing.Imaging.ImageFormat.Png);

                    Hussam Fattahi wrote:

                    thanks, any way .. please, excuse my bad english.

                    It's ok, I'm Yemeni as well. Good luck Hussam:)


                    Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

                    1 Reply Last reply
                    0
                    • M Muammar

                      By the way, what are you trying to do?? I saw your posts here in the forum since February and it looks like you're trying to develop some sort of a Trojan/ hacking application.. Just hopping we're helping in that:~


                      Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

                      V Offline
                      V Offline
                      Vasudevan Deepak Kumar
                      wrote on last edited by
                      #10

                      A mini hacker's lounge within C# forum? :-D

                      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                      M 1 Reply Last reply
                      0
                      • V Vasudevan Deepak Kumar

                        A mini hacker's lounge within C# forum? :-D

                        Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                        M Offline
                        M Offline
                        Muammar
                        wrote on last edited by
                        #11

                        :laugh::laugh:


                        Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups