Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 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.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace WindowsFormsApplication2
  13. {
  14. public partial class Form1 : Form
  15. {
  16. List<string> One = new DirectoryInfo("../../../../1 балла").GetFiles().Select(i => (i.Name)).ToList();
  17. List<string> Two = new DirectoryInfo("../../../../2 балла").GetFiles().Select(i => (i.Name)).ToList();
  18. List<string> Three = new DirectoryInfo("../../../../3 балла").GetFiles().Select(i => (i.Name)).ToList();
  19. string RoadOne = "../../../../1 балл";
  20. string RoadTwo = "../../../../2 балла";
  21. string RoadThree = "../../../../3 балла";
  22. static Random rand = new Random();
  23. public int PocRand = 0;
  24. public int number = 0;
  25. public Form1()
  26. {
  27. InitializeComponent();
  28. }
  29.  
  30. private void button1_Click(object sender, EventArgs e)
  31. {
  32. number = 1;
  33. PocRand = rand.Next(0, One.Count);
  34. Bitmap image1 = new Bitmap(RoadOne + One[PocRand]);
  35. pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
  36. pictureBox1.Image = image1;
  37. }
  38.  
  39. private void button4_Click(object sender, EventArgs e)
  40. {
  41. pictureBox1.Image = null;
  42. //button5.Text = "Ответ";
  43. }
  44.  
  45. private void button5_Click(object sender, EventArgs e)
  46. {
  47. if (number == 1)
  48. {
  49. MessageBox.Show(One[PocRand]);
  50. }
  51. if (number == 2)
  52. {
  53. MessageBox.Show(Two[PocRand]);
  54. }
  55. if (number == 3)
  56. {
  57. MessageBox.Show(Three[PocRand]);
  58. }
  59. }
  60.  
  61. private void button2_Click(object sender, EventArgs e)
  62. {
  63. number = 2;
  64. PocRand = rand.Next(0, Two.Count);
  65. Bitmap image1 = new Bitmap(RoadTwo + Two[PocRand]);
  66. pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
  67. pictureBox1.Image = image1;
  68. }
  69.  
  70. private void button3_Click(object sender, EventArgs e)
  71. {
  72. number = 3;
  73. PocRand = rand.Next(0, Three.Count);
  74. Bitmap image1 = new Bitmap(RoadThree + Three[PocRand]);
  75. pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
  76. pictureBox1.Image = image1;
  77. }
  78.  
  79. private void Form1_Load(object sender, EventArgs e)
  80. {
  81.  
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement