0

Through c# language and WinForm How to access image data directly from the in a program window instead of calling a screenshot API like copyfromscreen? Finally, i need to get an image object

  • What kind of data are you lookin for, like size, width. things like that? – WhoAmI Aug 23 '21 at 13:30
  • just image data,i want to get a system.drawing.image object – hairenaaa Aug 23 '21 at 13:32
  • Based on the comment you posted, you probably need `PrintWindow`. Just posted a few minutes ago: [Print an image of the content of a Panel excluding any external overlapping Window](https://stackoverflow.com/q/68890833/7444103) – Jimi Aug 23 '21 at 15:50

1 Answers1

0

Something like this?

using System.Drawing;

private void DemonstratePropertyItem(PaintEventArgs e)
{

    // Create two images.
    Image image1 = Image.FromFile("c:\\FakePhoto1.jpg");
    Image image2 = Image.FromFile("c:\\FakePhoto2.jpg");

    // Get a PropertyItem from image1.
    PropertyItem propItem = image1.GetPropertyItem(20624);

    // Change the ID of the PropertyItem.
    propItem.Id = 20625;

    // Set the PropertyItem for image2.
    image2.SetPropertyItem(propItem);

    // Draw the image.
    e.Graphics.DrawImage(image2, 20.0F, 20.0F);
}
WhoAmI
  • 1,188
  • 6
  • 17
  • 47
  • Sorry, this is not what I want. What I want is: for example, there is an open window on the desktop. This window can be the window of other applications, and another window covers this window. If I use copy from screen, I will get the covered window image. This is not what I want. I want the image of the covered window – hairenaaa Aug 23 '21 at 13:57