Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication2
- {
- public partial class Form1 : Form
- {
- List<string> One = new DirectoryInfo("../../../../1 балла").GetFiles().Select(i => (i.Name)).ToList();
- List<string> Two = new DirectoryInfo("../../../../2 балла").GetFiles().Select(i => (i.Name)).ToList();
- List<string> Three = new DirectoryInfo("../../../../3 балла").GetFiles().Select(i => (i.Name)).ToList();
- string RoadOne = "../../../../1 балл";
- string RoadTwo = "../../../../2 балла";
- string RoadThree = "../../../../3 балла";
- static Random rand = new Random();
- public int PocRand = 0;
- public int number = 0;
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- number = 1;
- PocRand = rand.Next(0, One.Count);
- Bitmap image1 = new Bitmap(RoadOne + One[PocRand]);
- pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
- pictureBox1.Image = image1;
- }
- private void button4_Click(object sender, EventArgs e)
- {
- pictureBox1.Image = null;
- //button5.Text = "Ответ";
- }
- private void button5_Click(object sender, EventArgs e)
- {
- if (number == 1)
- {
- MessageBox.Show(One[PocRand]);
- }
- if (number == 2)
- {
- MessageBox.Show(Two[PocRand]);
- }
- if (number == 3)
- {
- MessageBox.Show(Three[PocRand]);
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- number = 2;
- PocRand = rand.Next(0, Two.Count);
- Bitmap image1 = new Bitmap(RoadTwo + Two[PocRand]);
- pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
- pictureBox1.Image = image1;
- }
- private void button3_Click(object sender, EventArgs e)
- {
- number = 3;
- PocRand = rand.Next(0, Three.Count);
- Bitmap image1 = new Bitmap(RoadThree + Three[PocRand]);
- pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
- pictureBox1.Image = image1;
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement