コード例 #1
0
ファイル: Form1.cs プロジェクト: AlgothAybara/C-Sharp
        /// <summary>
        /// Enables input values, clears feedback label, calls the RollDice function.
        /// </summary>
        private void roll_button_Click(object sender, EventArgs e)
        {
            check_buton.Enabled  = true;
            guess_updown.Enabled = true;
            feedback_label.Text  = "";
            total += 1;

            Rose_Die.RollDice();
            total_textbox.Text = total.ToString();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: AlgothAybara/C-Sharp
        /// <summary>
        /// Loads picture boxes with generic images, disables input fields, and clears some labels on load
        /// </summary>
        public void Form1_Load(object sender, EventArgs e)
        {
            feedback_label.Text  = "";
            check_buton.Enabled  = false;
            guess_updown.Enabled = false;

            for (int i = 1; i < 6; i++)
            {
                Rose_Die die = GenerateDice(i, 0);
                dice.Add(die);
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: AlgothAybara/C-Sharp
        /// <summary>
        /// Builds each picture box and instantiates the Rose_Die objects
        /// </summary>
        /// <returns>Rose_Die object</returns>
        public Rose_Die GenerateDice(int counter, int value)
        {
            this.pictureBox1 = new Rose_Die();

            int xLoc = (counter * 185);

            this.pictureBox1.Image     = diceArray[value];
            this.pictureBox1.Location  = new System.Drawing.Point(xLoc, 125);
            this.pictureBox1.Margin    = new System.Windows.Forms.Padding(7);
            this.pictureBox1.Name      = $"pictureBox{counter}";
            this.pictureBox1.Size      = new System.Drawing.Size(159, 160);
            this.pictureBox1.TabIndex  = 0;
            this.pictureBox1.TabStop   = false;
            this.pictureBox1.FaceValue = pictureBox1.Roll();

            this.Controls.Add(this.pictureBox1);
            return(pictureBox1);
        }