You are viewing our Forum Archives. To view or take place in current topics click here.
[C#] Simple PC Screenshot Taker (With Source Code)
Posted:

[C#] Simple PC Screenshot Taker (With Source Code)Posted:

Nathanael
  • Ladder Climber
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}
#2. Posted:
99rock99
  • Resident Elite
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?
#3. Posted:
CLK
  • Wise One
Status: Offline
Joined: Jun 12, 201014Year Member
Posts: 531
Reputation Power: 33
Status: Offline
Joined: Jun 12, 201014Year Member
Posts: 531
Reputation Power: 33
99rock99 wrote
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?


In .NET it doesn't capture the cursor.
#4. Posted:
Nathanael
  • Ladder Climber
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
-CLK- wrote
99rock99 wrote
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?


In .NET it doesn't capture the cursor.


yup that is correct so do you guys like it?
#5. Posted:
99rock99
  • Resident Elite
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Nathanael wrote
-CLK- wrote
99rock99 wrote
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?


In .NET it doesn't capture the cursor.


yup that is correct so do you guys like it?


It is nice. I like the capture button. Java doesn't capture the cursor either. I have to draw it on manually, which is why mine has a select cursor option.
#6. Posted:
Nathanael
  • Ladder Climber
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
99rock99 wrote
Nathanael wrote
-CLK- wrote
99rock99 wrote
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?


In .NET it doesn't capture the cursor.


yup that is correct so do you guys like it?


It is nice. I like the capture button. Java doesn't capture the cursor either. I have to draw it on manually, which is why mine has a select cursor option.

that would be a good idea if i ever made an update for this thing, but i have only added and update button to one of my projects. the update button connects to my website, checks for the latest version, and if i have the latest version it tells me that, but if i need to update it downloads the files and then gives me the option to update or not. its really handy and i may make a tutorial on how to do that because i dont think i have seen many tutorials about that.
#7. Posted:
99rock99
  • Resident Elite
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Nathanael wrote
99rock99 wrote
Nathanael wrote
-CLK- wrote
99rock99 wrote
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?


In .NET it doesn't capture the cursor.


yup that is correct so do you guys like it?


It is nice. I like the capture button. Java doesn't capture the cursor either. I have to draw it on manually, which is why mine has a select cursor option.

that would be a good idea if i ever made an update for this thing, but i have only added and update button to one of my projects. the update button connects to my website, checks for the latest version, and if i have the latest version it tells me that, but if i need to update it downloads the files and then gives me the option to update or not. its really handy and i may make a tutorial on how to do that because i dont think i have seen many tutorials about that.


That would be nice, too bad you can't make one for java... or can you?
#8. Posted:
Nathanael
  • Ladder Climber
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
99rock99 wrote
Nathanael wrote
99rock99 wrote
Nathanael wrote
-CLK- wrote
99rock99 wrote
Nathanael wrote Download Link: [ Register or Signin to view external links. ]



Pictures:
[ Register or Signin to view external links. ]


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ScreenshotCapturer
{
    public partial class Form1 : Form
    {
        private static Bitmap bmpScreenshot;
        private static Graphics gfxScreenshot;

        public Form1()
        {
            InitializeComponent();
        }
        private void btnCapture_Click(object sender, EventArgs e)
        {
             // If the user has chosen a path where to save the screenshot
            if (saveScreenshot.ShowDialog() == DialogResult.OK)
            {
                // Hide the form so that it does not appear in the screenshot
                this.Hide();
                //hides the form for 1000 miliseconds
                System.Threading.Thread.Sleep(1000);
                // Set the bitmap object to the size of the screen
                bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                // Create a graphics object from the bitmap
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                // Take the screenshot from the upper left corner to the right bottom corner
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                // Save the screenshot to the specified path that the user has chosen
                bmpScreenshot.Save(saveScreenshot.FileName, ImageFormat.Png);
                // Show the form again
                this.Show();
            }
        }
    }
}


What a coincidence I am making one as well. I was going to release it today, but the i had a little trouble with the jar file that I am still trying to work out.
I didn't see a mouse on yours. Did I miss it, or does it not display?


In .NET it doesn't capture the cursor.


yup that is correct so do you guys like it?


It is nice. I like the capture button. Java doesn't capture the cursor either. I have to draw it on manually, which is why mine has a select cursor option.

that would be a good idea if i ever made an update for this thing, but i have only added and update button to one of my projects. the update button connects to my website, checks for the latest version, and if i have the latest version it tells me that, but if i need to update it downloads the files and then gives me the option to update or not. its really handy and i may make a tutorial on how to do that because i dont think i have seen many tutorials about that.


That would be nice, too bad you can't make one for java... or can you?

i never have really tried java much, at one point i wanted to develop for android but i got bored of it and quit (probably because i didnt know what i was doing)
#9. Posted:
99rock99
  • Resident Elite
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Probably, but android development is a bit to difficult for me. I will stick to desktop apps fir now. Also does your updater work for java? I am trying to search for one now, but it would be nice to know.
#10. Posted:
Nathanael
  • Ladder Climber
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
Status: Offline
Joined: Mar 26, 201113Year Member
Posts: 360
Reputation Power: 18
99rock99 wrote Probably, but android development is a bit to difficult for me. I will stick to desktop apps fir now. Also does your updater work for java? I am trying to search for one now, but it would be nice to know.


as of right now i dont think it works for java. i know the automatic updater works for C#, and VB. if you are using c++, or F#, ect then you have to use a standalone updater.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.