using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing.Imaging;
using System.Drawing;
using System.Windows.Forms;
public partial class CSharp_CaptureScreen : System.Web.UI.Page
{
private static Bitmap ScreenImage;
private static Graphics ScreenGraphic;
protected void Page_Load(object sender, EventArgs e)
{
CaptureScreen();
}
private void CaptureScreen()
{
ScreenImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
ScreenGraphic = Graphics.FromImage(ScreenImage); //Convert from image to graphic
ScreenGraphic.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
ScreenImage.Save(Server.MapPath("~/Images/MyScreenshot1.jpg"));
}
}
Serialization and De-serialization in C#
15 years ago