Bonjour à tous,
Voilà j'ai ce code récupéré sur Programmez qui permet de
faire des captures d'écran :
Hors je n'arrive pas à l'exploiter...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 private static Bitmap CaptureScreen(Rectangle rect) { Bitmap bitmap = new Bitmap(rect.Width, rect.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(rect.Left, rect.Top, 0,0, rect.Size, CopyPixelOperation.SourceCopy); } return bitmap; }
J'ai fait ça :
Dans ma Form, mais sans succès
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 private void button1_Click(object sender, EventArgs e) { CaptureScreen(Screen.PrimaryScreen.Bounds); }![]()
Comment faire pour me servir de ce code ?
Merci.
Partager