Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 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. using cars;
  11.  
  12. namespace week3
  13. {
  14. public partial class Form1 : Form
  15. {
  16. private String imagePath;
  17. private CarManager carManager;
  18. public Form1()
  19. {
  20. InitializeComponent();
  21. carManager = new CarManager();
  22. }
  23.  
  24. private void label1_Click(object sender, EventArgs e)
  25. {
  26.  
  27. }
  28.  
  29. private void Form1_Load(object sender, EventArgs e)
  30. {
  31.  
  32. }
  33.  
  34. private void btnAddCar_Click(object sender, EventArgs e)
  35. {
  36. int fuel = Convert.ToInt32(txtFuel.Text);
  37. string carID = txtCarID.Text;
  38. carManager.addCar(carID, fuel, imagePath);
  39.  
  40. Panel carPanel = new System.Windows.Forms.Panel();
  41. carPanel.Width = 100;
  42. carPanel.Height = 100;
  43.  
  44. PictureBox carImg = new System.Windows.Forms.PictureBox();
  45. carImg.Size = new System.Drawing.Size(100, 100);
  46. carImg.ImageLocation = imagePath;
  47. carPanel.Controls.Add(carImg);
  48.  
  49. pnlCars.Controls.Add(carPanel);
  50.  
  51. }
  52.  
  53.  
  54.  
  55. private void btnImg_Click(object sender, EventArgs e)
  56. {
  57. OpenFileDialog imgDialog = new OpenFileDialog();
  58. imgDialog.InitialDirectory = "C:\\";
  59. if (imgDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  60. {
  61. imagePath = imgDialog.FileName;
  62. carImg.ImageLocation = imagePath;
  63. }
  64. }
  65.  
  66.  
  67. private void carImg_Click(object sender, EventArgs e)
  68. {
  69.  
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement