Files
01-Siyuan-MesProject/MisData_3.0_2022.08.23.1622.LLX/MisDataBak/MisMenuFunction/Start/PrintScreen.cs
2026-05-29 10:07:05 +08:00

56 lines
1.5 KiB
C#

using DataLinkMesWork;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class MisData
{
private void PrintMainForm(object obj)
{
try
{
string ScreenPrintPath = ApplicationConfig.TraceFolderPath + "MisPrint";
Thread.Sleep(10);
Bitmap image = new Bitmap(this.Width, this.Height);
Graphics imgGraphics = Graphics.FromImage(image);
imgGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, new Size(this.Width, this.Height));
DateTime currentTime = new System.DateTime();
currentTime = System.DateTime.Now;
if (!Directory.Exists(ScreenPrintPath))
{
Directory.CreateDirectory(ScreenPrintPath);
}
image.Save(ScreenPrintPath+"\\MIS快照_" + currentTime.ToString().Replace(" ", "").Replace("/", "").Replace(":", "") + ".jpeg", ImageFormat.Jpeg);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
private void PrintMainForm_Thread()
{
Thread t = new Thread(new ParameterizedThreadStart(PrintMainForm));
t.Start(this );
}
}
}