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)
        {
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.