A Simple Drawing of a House
Thanks to Mark Sobkowicz at Lincoln Sudbury
http://www.lsrhs.net/departments/science/faculty/sobkowiczm/introprogramming/default.html
To make the simple drawing, drag a canvas into a new window. The commands you need you will find in the methods of the graphics class. Drawing commands you want executed as soon as the window opens should go in the Paint event of the canvas. You can also put drawing commands in the Action event of a button, or anywhere else, really.
To use one of the drawing commands, check to see what parameters the command requires. For instance, the Drawline command requires four integers, X1, Y1, X2, and Y2. X-values are measured (in pixels) from the left edge of the canvas, and Y-values are measured (in pixels) down from the top of the canvas. Put this command into the Paint event of the canvas:
g.drawline 20,50,90,60
While the methods of the graphics class do the drawing, the properties change things about the drawing. For instance, the forecolor property sets the drawing color.
g.forecolor = rgb(255, 0, 0)
will change the drawing color to red for all drawings that come after the command.
Colorsrgb(number1, number2, number3) will give a color where number1 is the amount of red, number2 the amount of green, and number3 the amount of blue.
Assignment: Make a drawing of a house using the graphics commands with several colors.