Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace losowanie
  12. {
  13. public partial class Form1 : Form
  14. {
  15. private Animacja AN;
  16. public Form1()
  17. {
  18. InitializeComponent();
  19.  
  20. }
  21.  
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. openFileDialog1.ShowDialog();
  25. }
  26. private void richTextBox1_TextChanged(object sender, EventArgs e)
  27. {
  28.  
  29. }
  30.  
  31. private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
  32. {
  33. string filePath = openFileDialog1.FileName;
  34. string[] lines = System.IO.File.ReadAllLines(filePath);
  35. textBox1.Text = filePath;
  36. foreach (string line in lines)
  37. {
  38. richTextBox1.Text += line + '\n';
  39. }
  40. button2.Enabled = true;
  41. }
  42.  
  43. private void button2_Click(object sender, EventArgs e)
  44. {
  45. AN = new Animacja();
  46. AN.Setparent(this);
  47.  
  48. AN.Show();
  49.  
  50. string filePath = openFileDialog1.FileName;
  51. string[] lines = System.IO.File.ReadAllLines(filePath);
  52.  
  53. Random rand1 = new Random();
  54. int num1 = rand1.Next(0, 5);
  55. textBox2.Text = lines[num1];
  56.  
  57. }
  58.  
  59.  
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement