Autor Beitrag
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Do 09.08.07 14:44 
Hallo,

ich möchte den Screenshot eines Programmfensters in einer PictureBox ausgeben, nur bekomme ich irgendwie das Graphics-Objekt nicht in die Image-Property der picturebox.

Wie funktioniert das und kann mir jemand den Grund erklären, warum das so "kompliziert" ist? ;)

ausblenden C#-Quelltext
1:
2:
3:
4:
Graphics screen = Graphics.FromHwnd(handle);
pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Graphics pbGraph = pictureBox1.CreateGraphics();
// Wie weiter?


Danke im Voraus ;)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 09.08.07 15:45 
user profile iconUGrohne hat folgendes geschrieben:
Wie funktioniert das
Gar nicht.

Wenn es Dir reicht, den ganzen Bildschirm zu nehmen, schau Dir mal Graphics.CopyFromScreen (oder so ähnlich) an.

Ansonsten musst Du wohl über PInvoke gehen:
www.bobpowell.net/capture.htm

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
UGrohne Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Do 09.08.07 19:31 
Hmm, is ja toll :(

Aber ich brauche die die Fenster. Wunder mich nur, dass ich dann mit P/Invoke arbeiten muss, dachte eigentlich, dass so etwas unterstützt sein sollte :(

Trotzdem danke, ich werde mir das mal anschauen ;)