Advertisement
Mboy1985

Untitled

May 26th, 2023
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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 WindowsFormsApp15
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. string[] menu = { "burger", "pizza"};
  23. Random maszynaLosujaca = new Random();
  24. int wylosowanaPozycja = maszynaLosujaca.Next(menu.Length);
  25. string wylosowaneJedzenie = menu[wylosowanaPozycja];
  26. lblDanie.Text = wylosowaneJedzenie;
  27. string obrazekJedzenia = $@"{AppDomain.CurrentDomain.BaseDirectory}\obrazki\{wylosowaneJedzenie}.jpg";
  28. pictureBox1.Image = Image.FromFile(obrazekJedzenia);
  29.  
  30. }
  31.  
  32. private void lblDanie_Click(object sender, EventArgs e)
  33. {
  34.  
  35. }
  36.  
  37. private void pictureBox1_Click(object sender, EventArgs e)
  38. {
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement