Easy way to draw pictures with code?

Posted 03 December 2009 - 09:14 PM

Hi guys,
I am wondering if anyone has a better idea for how to draw little pictures with code? Currently I draw it with code and keep checking on it until I get it right, it takes alot of guess work to begin with, and takes a while to complete. Any ideas?

Oh, and to show i'm not just after someone else to do it for me, here is my smiley face code (Which draws a smiley face on the mouse up event).

Replies To: Easy way to draw pictures with code?

Re: Easy way to draw pictures with code?

Posted 03 December 2009 - 09:31 PM

Try drawing the image in a paint program or on graph paper to get an idea of what coordinates to use for the image. With the paint program you would probably want to zoom in and make sure that the grid was visible to have a good idea of where the pixels are. Other than that I would say to it is pretty much trial and error and you would have to do what you are doing. Draw the image and then make it look the way you want it to.

Re: Easy way to draw pictures with code?

OK, thanks, that might help. I got a feeling it's going to take a long time though, I want to create about 100 little pictures

Creating pictures usually does take a far bit of time. You might want to consider creating a class of reusable methods that will draw similar pictures.

If you just want images to appear on the screen where the mouse was clicked, that is what the code you posted looks like, you could also create your images with a paint program, add them as resources to your project or load them in at run time, and use the DrawImage method of the Graphics class to draw the image at the appropriate place. That would save you considerable time and effort.

Re: Easy way to draw pictures with code?

Posted 03 December 2009 - 10:29 PM

SixOfEleven, on 4 Dec, 2009 - 01:31 PM, said:

If you just want images to appear on the screen where the mouse was clicked, that is what the code you posted looks like, you could also create your images with a paint program, add them as resources to your project or load them in at run time, and use the DrawImage method of the Graphics class to draw the image at the appropriate place. That would save you considerable time and effort.