Bonjour j'ai 2 soucis...
je voudrais réaliser la capture de mon application.
pour cela j'utilise ce morceau de code :
ca...ca marche...le hic...le premier...c'est que si je lance 2 copie d'ecran...j'ai une exception qui se lève sur la méthode save du Bitmap :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb); // Create a graphics object from the bitmap Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot); // Take the screenshot from the upper left corner to the right bottom corner gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy); // Save the screenshot to the specified path that the user has chosen string pictureName = "screenshot.png"; bmpScreenshot.Save(@"Logs\" + pictureName, ImageFormat.Png);
meme en effacant le fichier généré la 1ere fois...rien n'y fait...A generic error occured in GDI+
ensuite le seconde problème, lors de la capture d'ecran, j'ai une MessageDialog en 1er plan, par exemple cette MessageDialog possède un bouton qui lance ma capture d'ecran, or...je voudrais prendre la capture de ma fenetre principale...qui se situe forcément au 2nd plan...auriez-vous une idée pour résoudre ces problèmes...
D'avance merci
Partager