Jump to content
  • Advertisement
Sign in to follow this  

[.net] C# Clipboard and pasting images from games

This topic is 4256 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm trying to get images taken in games with the 'Print Screen' key to be pasted into my picturebox control in the application I am developing. (C# .NET2) At the moment I am testing this out in a game called Rome: Total War, and am able to paste the screenshot from the clipboard into Microsoft Paint but am unable to paste it into my application. Below are 2 code samples for the methods I have tried.
if(Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap))
    pictureBox1.Image = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
and
if (Clipboard.ContainsImage())
     pictureBox1.Image = Clipboard.GetImage());
Both of these samples return true in the if statement (I.e. there is am image in the clipboard) but then I came to extract the image on the next line all I get is a null value. I also tested these code samples with a screenshot taken of a standard windows desktop and that worked fine. What do I have to do to get it to work with 3D games. I'm guessing it can be done since Paint can do it and the if statements say I have valid data. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!