#

C#:  Windows ScreenShot als Datei speichern in WPF, Winforms, Windows Classic Desktop Application

 

Diese Anwendung in Windows WPF speichert den aktuellen Monitor als Screenshot in einer .png Datei

 

 

Video Tutorial

 

Diese Anwendung in Windows WPF speichert den aktuellen Monitor als Screenshot in einer .png Datei

 

 

 

C# Code in WPF, Win32

private void save_ScreenShot_as_File()

        {

            //------------< save_ScreenShot_as_File() >------------

            //*add reference System.Drawings

            //*using System.Drawing;

 

            //< init >

            String filename = "ScreenCapture-" + DateTime.Now.ToString("ddMMyyyy-hhmmss") + ".png";

            //</ init >

 

            //< size >

            int screenLeft = (int) SystemParameters.VirtualScreenLeft ;

            int screenTop = (int) SystemParameters.VirtualScreenTop;

            int screenWidth = (int) SystemParameters.VirtualScreenWidth;

            int screenHeight = (int) SystemParameters.VirtualScreenHeight;

            //</ size >

 

            Bitmap bitmap_Screen = new Bitmap(screenWidth, screenHeight);

            Graphics g = Graphics.FromImage(bitmap_Screen);               

           

            //-< get ScreenShot >

            //*into bitmap as graphics

            g.CopyFromScreen(screenLeft, screenTop, 0, 0, bitmap_Screen.Size);

            //-</ get ScreenShot >

 

            //< save bitmap >

            bitmap_Screen.Save("C:\\_Daten\\Desktop\\Backgrounds\\" + filename);

            //</ save bitmap >

            

            //------------</ save_ScreenShot_as_File() >------------

        }

 

 

Namespace

Man muss Systems.Drawings einbinden

using System.Drawing; //for bitmap, screenshot

Mobile

.

0123movie.net