using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DiceSimulator
{
    public partial class Form1 : Form
    {
        StandardDie die1, die2, die3, die4, die5;
        Random rand;
        public Form1()
        {
            InitializeComponent();
            rand = new Random();
        }
        /// <summary>
        /// This is the Event Handler for the Form's Load event.
        /// </summary>
        /// <param name="sender">The object that triggered the event (not used in this application)</param>
        /// <param name="e">The arguments associated with this event (not used in this application)</param>
        private void Form1_Load(object sender, EventArgs e)
        {
            die1 = new StandardDie(rand);
            die2 = new StandardDie(rand);
            die3 = new StandardDie(rand);
            die4 = new StandardDie(rand);
            die5 = new StandardDie(rand);
        }
        /// <summary>
        /// This is the Event Handler for the Roll Dice button's Click event.
        /// </summary>
        /// <param name="sender">The object that triggered the event (not used in this application)</param>
        /// <param name="e">The arguments associated with this event (not used in this application)</param>
        private void btnRollDice_Click(object sender, EventArgs e)
        {
            pictureBox1.Image = die1.Roll;
            pictureBox2.Image = die2.Roll;
            pictureBox3.Image = die3.Roll;
            pictureBox4.Image = die4.Roll;
            pictureBox5.Image = die5.Roll;
        }
        private void pictureBox3_Click(object sender, EventArgs e)
        {
        }
    }
}

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.