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