This C# code for capturing screen shots. This code returns bitmap image save this image in computer.
private static Bitmap BitMapCreater() { Rectangle rect = Screen.PrimaryScreen.Bounds; int color = Screen.PrimaryScreen.BitsPerPixel; PixelFormat pFormat; switch (color) { case 8: case 16: pFormat = PixelFormat.Format16bppRgb565; break;
case 24: pFormat = PixelFormat.Format24bppRgb; break;
case 32: pFormat = PixelFormat.Format32bppArgb; break;
default: pFormat = PixelFormat.Format32bppArgb; break; } Bitmap bmp = new Bitmap(rect.Width, rect.Height, pFormat); Graphics g = Graphics.FromImage(bmp); g.CopyFromScreen(rect.Left, rect.Top, 0, 0, rect.Size); return bmp; } call this method to SAVE file
on Button Click() { Bitmap b = BitMapCreater(); printScreen = string.Format("{0}{1}", Path.GetTempPath(), "screen" + i + ".jpg"); b.Save(printScreen, ImageFormat.Jpeg);
}
|
| Author: vijetha 29 May 2008 | Member Level: Gold Points : 2 |
U can Try this also
this.Hide(); Bitmap Bitmap; Graphics Graps; Bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb); Graps = Graphics.FromImage(Bitmap); Graps.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy); Bitmap.Save(System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\YourShot.jpeg", ImageFormat.Jpeg); MessageBox.Show("Your Screen Shot Save in Desktop"); this.Show();
|
| Author: Raju.M 29 May 2008 | Member Level: Gold Points : 2 |
Ok vijetha
|
| Author: komaladevi 29 May 2008 | Member Level: Gold Points : 2 |
good one
|
| Author: Kumar Velu 30 May 2008 | Member Level: Diamond Points : 2 |
nice...
|