[Csharp]
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;
Namespace Screen
{
Public partial class Form1: Form
{
Public Form1 ()
{
// The desktop of the main form is not displayed only in the process
InitializeComponent ();
This. WindowState = FormWindowState. Minimized;
This. ShowInTaskbar = false;
SetVisibleCore (false );
}
Protected override void SetVisibleCore (bool value)
{
Base. SetVisibleCore (value );
}
Private void timereffectick (object sender, EventArgs e)
{
// Obtain the current screen size
Rectangle rect = new Rectangle ();
Rect = System. Windows. Forms. Screen. GetWorkingArea (this );
Size mySize = new Size (rect. Width, rect. Height );
Bitmap bitmap = new Bitmap (rect. Width, rect. Height );
Graphics g = Graphics. FromImage (bitmap );
G. CopyFromScreen (0, 0, 0, 0, mySize );
String ImageName = DateTime. Now. ToString ("yyyyMMdd_hhmmss") + ". jpg ";
Bitmap. Save ("F: // screen //" + ImageName );
// Release resources
Bitmap. Dispose ();
G. Dispose ();
GC. Collect ();
}
Private void Form1_Load (object sender, EventArgs e)
{
Timer1.Enabled = true; // activate the timer control
}
}
}