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.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp15
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string[] menu = { "burger", "pizza"};
- Random maszynaLosujaca = new Random();
- int wylosowanaPozycja = maszynaLosujaca.Next(menu.Length);
- string wylosowaneJedzenie = menu[wylosowanaPozycja];
- lblDanie.Text = wylosowaneJedzenie;
- string obrazekJedzenia = $@"{AppDomain.CurrentDomain.BaseDirectory}\obrazki\{wylosowaneJedzenie}.jpg";
- pictureBox1.Image = Image.FromFile(obrazekJedzenia);
- }
- private void lblDanie_Click(object sender, EventArgs e)
- {
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement