Ja du har ret. Beskrivelsen er lidt tynd. Smider lige et billede op og koderne.
http://i40.tinypic.com/15d6ywn.jpg- 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 DndClient
- {
- public partial class AbilityGenerator : Form
- {
- DiceRoller diceRoller = new DiceRoller();
-
- public AbilityGenerator()
- {
- InitializeComponent();
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- // Udføre en random i alle textboxe som er datasource
- textBox2.Text = diceRoller.AbilityRoll(4, 1, 6).Take(3).Sum().ToString();
- textBox3.Text = diceRoller.AbilityRoll(4, 1, 6).Take(3).Sum().ToString();
- textBox4.Text = diceRoller.AbilityRoll(4, 1, 6).Take(3).Sum().ToString();
- textBox5.Text = diceRoller.AbilityRoll(4, 1, 6).Take(3).Sum().ToString();
- textBox6.Text = diceRoller.AbilityRoll(4, 1, 6).Take(3).Sum().ToString();
- textBox7.Text = diceRoller.AbilityRoll(4, 1, 6).Take(3).Sum().ToString();
-
- }
-
- #region MouseDown EventHandler
- // Textbox fra 2-7 er datasource
- private void textBox7_MouseDown(object sender, MouseEventArgs e)
- {
- textBox7.DoDragDrop(textBox7.Text, DragDropEffects.Copy | DragDropEffects.Move);
- }
-
- private void textBox6_MouseDown(object sender, MouseEventArgs e)
- {
- textBox6.DoDragDrop(textBox6.Text, DragDropEffects.Copy | DragDropEffects.Move);
- }
-
- private void textBox5_MouseDown(object sender, MouseEventArgs e)
- {
- textBox5.DoDragDrop(textBox5.Text, DragDropEffects.Copy | DragDropEffects.Move);
- }
-
- private void textBox4_MouseDown(object sender, MouseEventArgs e)
- {
- textBox4.DoDragDrop(textBox4.Text, DragDropEffects.Copy | DragDropEffects.Move);
- }
-
- private void textBox3_MouseDown(object sender, MouseEventArgs e)
- {
- textBox3.DoDragDrop(textBox3.Text, DragDropEffects.Copy | DragDropEffects.Move);
- }
-
- private void textBox2_MouseDown(object sender, MouseEventArgs e)
- {
- textBox2.DoDragDrop(textBox2.Text, DragDropEffects.Copy | DragDropEffects.Move);
- }
- #endregion
-
- #region DragDrop EventHandler
- // Textbox 8-13 har AllowDrop = true
- private void textBox13_DragDrop(object sender, DragEventArgs e)
- {
- textBox13.Text = e.Data.GetData(DataFormats.Text).ToString();
- }
-
- private void textBox12_DragDrop(object sender, DragEventArgs e)
- {
- textBox12.Text = e.Data.GetData(DataFormats.Text).ToString();
- }
-
- private void textBox11_DragDrop(object sender, DragEventArgs e)
- {
- textBox11.Text = e.Data.GetData(DataFormats.Text).ToString();
- }
-
- private void textBox10_DragDrop(object sender, DragEventArgs e)
- {
- textBox10.Text = e.Data.GetData(DataFormats.Text).ToString();
- }
-
- private void textBox9_DragDrop(object sender, DragEventArgs e)
- {
- textBox9.Text = e.Data.GetData(DataFormats.Text).ToString();
- }
-
- private void textBox8_DragDrop(object sender, DragEventArgs e)
- {
- textBox8.Text = e.Data.GetData(DataFormats.Text).ToString();
- }
- #endregion
-
- // Textbox 8-13 er linked til DropBoxes_DragEnter
- private void DropBoxes_DragEnter(object sender, DragEventArgs e)
- {
- //TextBox tx;
-
- //tx = sender as TextBox;
- //tx.Enabled = false;
-
- if (e.Data.GetDataPresent(DataFormats.Text))
- e.Effect = DragDropEffects.Copy;
- else
- e.Effect = DragDropEffects.None;
- }
-
- }
- }