CPS613

Module 06-Graphics

Toronto Metropolitan University University

Learning Objectives

In this module you will learn how to
  • create and work with elementary graphics through extended controls
  • implement context sensitive menus
  • draw on a control
  • dynamically shape controls
  • change mouse cursors dynamically

Module Description:

Summary

In this module you will be modifying a simple program where the user can right click on a extended control, called "Shape", to bring up a context sensitive menu which will allow the user to change the shape's colour, draw on the shape, re-shape the shape, or cancel the current drawing selection.

User Interface and Interaction

The application will behave like ModuleGraphics.zip

  1. An extended control of Button called "Shape", which will appear as a square (or another shape of your choice) that implements a context sensitive menu. When the control is selected, the cursor changes until it is deselected. This control can be dragged and dropped.

  2. When the user right clicks the Shape control, a menu will pop up that include the following menu items:
    • Colour: display different colour options. Upon selection the Shape control should change its base colour.
    • Draw Shape: this should start the drawing process. The user should be able to select different points to create a new polygon by clicking on them.
    • Cut Shape: after the user has drawn a shape with the Draw Shape option, selecting this will "cut" the control into what the user has drawn. Pressing the space bar has the same effect.
    • Cancel Shape: this should cancel the drawing process. After the user has a drawn a shape with the Draw Shape option, selecting this will erase the user's drawing. Pressing the ESC key has the same effect.

  3. After the user has drawn and cut the custom shape, the only selectable area to drag the shape should be confined to the newly cut shape. For example, if the user draws and cuts the shape into a triangle (when it was previously a square) only the area within the triangle should be selectable for dragging.

Handouts

In the Handouts directory you will find:

References

References for this module are in the Graphics Reference and
Explanations of all VB features needed for all the modules can be found at the General Assignment References page


This page is maintained by Sophie Quigley (cps613@cs.torontomu.ca)
Last modified Monday, 30-Oct-2023 17:32:53 EDT