Exercises - C# Graphical Interface

(last update: Thu Sep 29 08:33:19 CEST 2016)

1   Exercise - The Ecologist Programmer's Pet

Write an application that displays a main (modal) form. The form will contain:

When the user clicks on the button, your application will display a second (modal) form showing:

If the user clicks on "Cancel":

If the user clicks on "Accept":

2   Exercise - Timer

We will write an application making use of the Timer component. Our application will have one single main window, with two buttons, labelled "Start" and "Stop". It will also have one Label that will display a number.

When the user clicks on "Start", the application will start a timer that tick 4 times per second. Every time the Tick event arrives, the application will increment the number displayed by the label. When the user clicks on "Stop", the number on screen stop incrementing.

3   Exercise - Background Worker + Progress Bar

Write an application which displays one single form with two buttons, one progress bar and one label. The buttons will start and stop a background worker (BackgroundWorker) which will execute the following code:

for i from 1 to 1000
  sleep 500 milliseconds
  report progress

Buttons:

Progress bar:

Label :

Extra: fix the window size to 500 pixels (horizontally) and 200 pixels (vertically), and prevent the user from resizing the window

4   Exercise - Picture Display with Zoom

We will write a program that can display images in BMP format. It will have a menu bar with the following entries:

File > Open will display an OpenFileDialog and load the picture.
File > Quit will terminate the application
Help > Help will show an information message (MessageBox) saying that there is no help to show
Help > About will show your name

The window will have a status bar (StatusStrip) showing the coordinates of the mouse as you move it over the picture.

A mouse click with the left button will zoom in, a right click will zoom out.