Get graphics
-
Merry Christmas to everyone! Don't you know how I can get the image my form looks like? I've tried DrawToBitmap method, but with that I didn't get the graphics, just the controls. Please help if you can.
-
Merry Christmas to everyone! Don't you know how I can get the image my form looks like? I've tried DrawToBitmap method, but with that I didn't get the graphics, just the controls. Please help if you can.
What is it you are trying to do? Put a picture on the form or as a background for the form?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
-
Merry Christmas to everyone! Don't you know how I can get the image my form looks like? I've tried DrawToBitmap method, but with that I didn't get the graphics, just the controls. Please help if you can.
Hi, if you do the graphics correctly, you will catch it. Here is a tiny paint instruction: there are several steps to draw something so it becomes visible on the screen: 1. decide upon what object you want to draw; it normally is a Control (e.g. a Panel) or a Form itself. I prefer to add a Panel to a Form, then draw on the Panel. 2. create some variables (Rectangle, struct, class, whatever) that hold the parameters of your drawing. For a rectangle that could be top and left coordinate, and width+height, or just a Rectangle. etc. 3. create a Paint handler for that Panel, and do all your drawing in there, using the Graphics class and your variables. 4. when you want to change things, modify the variables and call Panel.Invalidate() or one of its overloads (for selective invalidation). 5. If you want to animate things, perform the move (step 4) inside the Tick handler of a Windows.Forms.Timer BTW: if you need to create some objects (Fonts, Pens, Brushes, ...) either keep them alive in class members (hence create them only once); or create them inside the Paint handler and don't forget to call Dispose() on them. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Happy Holidays!
-
What is it you are trying to do? Put a picture on the form or as a background for the form?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
Sorry I didn't write clearly, my problem is the following: I've a form, and controls in it. I want to get the same image that the user sees on the screen. If I don't use graphics, I can use DrawToBitmap method. But what should I do if I use graphics too??? :doh: