using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Timers;
namespace 董成__多线程
{
class Program
{
public static void Threadfa2()
{
while (true)
{
Thread.Sleep(1000);
bool judge = !Directory.Exists("tu");
if (judge)
{
Directory.CreateDirectory("tu");
}
Image image = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);
Graphics g = Graphics.FromImage(image);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(image.Width, image.Height));
Thread.Sleep(1000);
image.Save("tu" + "\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg");
}
}
public static void theout()
{
Random ran = new Random();
int RandKey = ran.Next(1000, 9999);
Thread.Sleep(1000);
Console.WriteLine("{0}", RandKey);
}
static void Main(string[] args)
{
//截图片
ThreadStart threadz2 = new ThreadStart(Threadfa2);
Thread thread2 = new Thread(threadz2);
thread2.Start();
while (true)
{
theout();
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Timers;
namespace 董成__多线程
{
class Program
{
public static void Threadfa2()
{
while (true)
{
Thread.Sleep(1000);
bool judge = !Directory.Exists("tu");
if (judge)
{
Directory.CreateDirectory("tu");
}
Image image = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);
Graphics g = Graphics.FromImage(image);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(image.Width, image.Height));
Thread.Sleep(1000);
image.Save("tu" + "\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg");
}
}
public static void theout()
{
Random ran = new Random();
int RandKey = ran.Next(1000, 9999);
Thread.Sleep(1000);
Console.WriteLine("{0}", RandKey);
}
static void Main(string[] args)
{
//截图片
ThreadStart threadz2 = new ThreadStart(Threadfa2);
Thread thread2 = new Thread(threadz2);
thread2.Start();
while (true)
{
theout();
}
}
}
}