Unformatted Attachment Preview
1. Develop a C# drawing program as shown in the next page. The following lists the
A. Apply polymorphism and dynamic binding for development of this drawing program.
B. Provide three buttons for the user to choose or change a desired shape for drawing.
C. A shape can be a line, a rectangle or an ellipse, and can be drawn in an arbitrary
D. A color based on RGB values can be set to color the subsequent drawn shapes.
E. The dynamic binding will call a shape’s drawColoredShape method to draw its own
shape based on the set color.
F. The system starts with a small window and the user can resize the window without
erasing the previously drawn shapes.
Hints: The Graphics, Bitmap, Color, Pen and Brush classes are likely to be used.
C# Keywords: virtual, override, abstract and internal may be useful. Feel free to check the C#
6.0 Specification and the Java-Csharp_Comparison.html file posted below Lab 1 on Canvas.
The Bitmap class is good for double buffering technique by using two images as the buffers.
The background Bitmap image should be filled up with a color first to prevent undesirable
Bitmap bm = new Bitmap(sizeX, sizeY);
Graphics g = Graphics.FromImage(bm);
● Polymorphism and dynamic binding: (2 pts)
● Program correctness: (3 pts)
● Double buffering technique applied: (2 points)