CST1801 Visual Basic I
Lab Week 10


Exercises

Exercise DrawShapes (20 points)

Write a program that uses the mouse to draw a ovals, rectangles, and lines on a picture box.  The upper-left coordinate should be the location where the user first pressed the mouse button, and the lower-right coordinate should be the location where the user releases the mouse button.

You are to provide a "rubber-banding" effect.  As the user drags the mouse, the user should be able to see the current size of the oval, rectangle, or line to know exactly what the shape will look like when the mouse button is released.

You need to provide a menu system so that the user can choose a shape.  Provide hot keys as well.  Also let the user exit the program and clear the drawing by means of the menu.

You must be able to draw from any beginning point to any ending point.  In other words, upper left to lower right as well as lower right to upper left.  Extra programming required to do this is most evident when drawing rectangular shapes.

You need to be able to select at least 4 colors and have the shapes drawn in those colors.

  Result (Save to your local machine and run)

Note:

Extra credit if you create a selection that will generate random colors each time you draw a shape (5 points)

Extra credit if you create a selection that allows the user to create custom colors using track bars or other similar method (5 points)