WinForms R P S Game - BNU-CO453/ConsoleApps15 GitHub Wiki

Windows Forms version of Rock-Paper-Scissors

App06 Model Answer from 2020

RPS GUI

PictureBox Image Property

In Windows Forms a PictureBox can be used to display an image as it has an image property. You can click on the Image property and import that image directly into the PictureBox. However if you need that image to change using program code then the images need to be added to the resources as shown below. Image Resources

Using BitMaps

You then need to add a BitMap for each image you want to use in the GameForm Adding Image Resources

Event Handlers

By double clicking on each of the radio buttons that selects Rock, Paper or Scissors you can generate an event handler which can be renamed DisplayRock for example. To avoid unnecessary code duplication a DisplayImage() method is also added. Event Handlers