ScreenShot Maker [Well Explained Tutorial - C#]
All tutorials created in C# to be posted in here.
7 posts
Page 1 of 1
Create a new Windows From Application.
Add:
3 buttons
1 Picture Box
Details: Follow this tutorial and you won't be confused!
Double click on your form and put this code above everything.
Insert this under the public form1()
This basically means that when your going to take a screenshot for the application to hide first then take the screenshot as a bmp then show the application. This way we do not have the physical application in the picture.
Button1: Capture
This is basically your clear button. If you do not like the picture you just took this will clear your picture box.
Button2: Clear
Button3: Save
If you see any errors or mistakes please point them out!
Add:
3 buttons
1 Picture Box
Details: Follow this tutorial and you won't be confused!
Double click on your form and put this code above everything.
Code: Select all
This is just your simple dim's(I am use too VB.net so thats what i know them as)using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
Insert this under the public form1()
Code: Select all
Double click your form and insert this code for your capture button. {
InitializeComponent();
}
private static Bitmap bmpScreenshot;
private static Graphics gfxScreenshot;
This basically means that when your going to take a screenshot for the application to hide first then take the screenshot as a bmp then show the application. This way we do not have the physical application in the picture.
Button1: Capture
Code: Select all
Now you may use a button, toolstrip button or anything for this.{
this.Hide();
System.Threading.Thread.Sleep(1000);
bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
pictureBox1.Image = bmpScreenshot;
System.Threading.Thread.Sleep(1000);
this.Show();
}
This is basically your clear button. If you do not like the picture you just took this will clear your picture box.
Button2: Clear
Code: Select all
This is how we will save your screenshot, this code tells the program too open a save window where you can chose where you want to save your image.{
pictureBox1.Image = null;
}
Button3: Save
Code: Select all
I hope this tutorial made sense and was helpful as this was my first C# tutorial!{
saveFileDialog1.FileName = "";
saveFileDialog1.ShowDialog();
try
{
pictureBox1.Image.Save(saveFileDialog1.FileName);
System.Diagnostics.Process.Start(saveFileDialog1.FileName);
saveFileDialog1.FileName = "";
}
catch
{
}
}
If you see any errors or mistakes please point them out!
Last edited by Code on Sun Sep 25, 2011 6:18 pm, edited 1 time in total.
You cant convert a string "" to a image. It will be an error at the clear code
Code: Select all
{
pictureBox1.Image = "";
}
Last edited by MrAksel on Sun Sep 25, 2011 11:27 am, edited 1 time in total.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

I think an empty string represents null(vbNull) but I don't know
i don't know about c# but in vb.net you can do
Code: Select all
picturebox1.image = nothing
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
Code: Select all
works finepicturebox1.Image = null;
Agust1337 wrote:OrCode: Select allworks finepicturebox1.Image = null;
Code: Select all
pictureBox1.Clear();
Sorry, i was not home. Just got back, i fixed up the code. Thanks for the help!
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023