Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Best way to get an image of a Form

Best way to get an image of a Form

Scheduled Pinned Locked Moved C#
graphicsquestionhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steve_
    wrote on last edited by
    #1

    Hi, I would like to be able to capture an image of an arbitrary window (though it is most likey that it will be a window I create). What is the best way to do this? I am currently using the Graphics.CopyFromScreen method to paint the section of the screen the window occupies to a bitmap but this has the obvious disadvantage that if the window is behind another, the image will also capture this overlap. Is there any other way of doing this that would solve this problem? Thanks, Steve

    C 1 Reply Last reply
    0
    • S Steve_

      Hi, I would like to be able to capture an image of an arbitrary window (though it is most likey that it will be a window I create). What is the best way to do this? I am currently using the Graphics.CopyFromScreen method to paint the section of the screen the window occupies to a bitmap but this has the obvious disadvantage that if the window is behind another, the image will also capture this overlap. Is there any other way of doing this that would solve this problem? Thanks, Steve

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I believe the control themselves have a rendertobitmap method that you can call, which I assume triggers a paint event but renders to a bitmap, not the screen.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      S 1 Reply Last reply
      0
      • C Christian Graus

        I believe the control themselves have a rendertobitmap method that you can call, which I assume triggers a paint event but renders to a bitmap, not the screen.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        S Offline
        S Offline
        Steve_
        wrote on last edited by
        #3

        I had a look for one initially but didn't find anything. Having had another look I can see Control.DrawToBitmap, perhaps I should have looked harder the first time! Thanks for your advice. Steve

        C 1 Reply Last reply
        0
        • S Steve_

          I had a look for one initially but didn't find anything. Having had another look I can see Control.DrawToBitmap, perhaps I should have looked harder the first time! Thanks for your advice. Steve

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          *grin* glad to help

          Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups