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. How do I draw the image of a 'System.Windows.Form.Control' instance onto another Form

How do I draw the image of a 'System.Windows.Form.Control' instance onto another Form

Scheduled Pinned Locked Moved C#
question
2 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.
  • A Offline
    A Offline
    astibich2
    wrote on last edited by
    #1

    I'm writing an editor Form that operates on any instance of a 'Control' class. I'd like to show an image of the active control context in the upper left of my Form - just so the user gets a visual of what control they are working on. Is there a way to get a Control to draw onto a Form that is not its parent? I've been play around with Control.DrawToBitmap, but I can't seem to make it work :( Thanks, Aaron

    S 1 Reply Last reply
    0
    • A astibich2

      I'm writing an editor Form that operates on any instance of a 'Control' class. I'd like to show an image of the active control context in the upper left of my Form - just so the user gets a visual of what control they are working on. Is there a way to get a Control to draw onto a Form that is not its parent? I've been play around with Control.DrawToBitmap, but I can't seem to make it work :( Thanks, Aaron

      S Offline
      S Offline
      S Senthil Kumar
      wrote on last edited by
      #2

      DrawToBitmap seems to work fine

      Bitmap b = new Bitmap(pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height);
      button1.DrawToBitmap(b, button1.ClientRectangle);

      pictureBox1.Image = b;

      The above code shows an image of the button in a picture box.

      Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

      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