Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

C# Fensterhandle + Screenshot

Empfohlene Antworten

Veröffentlicht

Tag zusammen,

ich baue mir gerade ein kleines Programm,

dies soll eine Screenshot funktion beinhalten.

Er soll aber nur ein Screenshot vom aktuellem Aktivem Fenster machen..

Sprich GetForegroundWindow()..

Da bekomme ich die ID vom Prozess wieder, jetzt müsste ich der screenshot funktion nurnoch sagen welche x,y werte das aktive fenster hat, oder der funktion direkt sagen hey mach nur vom prozess x den screenshot..



Bitmap b = new Bitmap(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height);

                    Graphics g = Graphics.FromImage(;

                    g.CopyFromScreen(0, 0, 0, 0, b.Size);

                    g.Dispose();


                    Bitmap bmpOutput = new Bitmap(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height, PixelFormat.Format24bppRgb);

                    Graphics gOutput = Graphics.FromImage(bmpOutput);

                    Rectangle rectOutput = new Rectangle(0, 0, bmpOutput.Width, bmpOutput.Height);


                    ImageAttributes ia = new ImageAttributes();

                    ia.SetWrapMode(WrapMode.TileFlipXY);


                    gOutput.InterpolationMode = InterpolationMode.HighQualityBilinear;

                    gOutput.PixelOffsetMode = PixelOffsetMode.Half;

                    gOutput.CompositingMode = CompositingMode.SourceCopy;


                    gOutput.DrawImage(b, rectOutput, 0, 0, SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height, GraphicsUnit.Pixel, ia);


                    bmpOutput.Save(BildNameOut, ImageFormat.Jpeg);


[/code]

Meine screenshot funktion.. Funktioniert soweit echt gut !

Nur macht sie halt einen screen vom ganzen Bildschirm und nicht nur vom aktivem fenster..

Kann mir da eventuell jemand weiter helfen ?

Wäre wirklich klasse...

Dankö,

grüße Patrick

  • 2 Wochen später...

Hi,

hier ein Beispiel, wie einfach ein Screenshot von einem Formular direkt aus dem jeweiligen Formular erstellt wird:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;


namespace Screenshotme

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void button1_Click(object sender, EventArgs e)

        {

            CaptureScreen();

        }


        /* AUS MSDN-BEISPIEL ENTNOMMEN */

        Bitmap memoryImage;


        private void CaptureScreen()

        {

            Graphics myGraphics = this.CreateGraphics();

            Size s = this.Size;

            memoryImage = new Bitmap(s.Width, s.Height, myGraphics);

            Graphics memoryGraphics = Graphics.FromImage(memoryImage);

            memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);

        }


    }

}

Ansonsten gibt es hier noch eine gute Quelle:

Capture-Screens

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.