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;
- using cars;
- namespace week3
- {
- public partial class Form1 : Form
- {
- private String imagePath;
- private CarManager carManager;
- public Form1()
- {
- InitializeComponent();
- carManager = new CarManager();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void btnAddCar_Click(object sender, EventArgs e)
- {
- int fuel = Convert.ToInt32(txtFuel.Text);
- string carID = txtCarID.Text;
- carManager.addCar(carID, fuel, imagePath);
- Panel carPanel = new System.Windows.Forms.Panel();
- carPanel.Width = 100;
- carPanel.Height = 100;
- PictureBox carImg = new System.Windows.Forms.PictureBox();
- carImg.Size = new System.Drawing.Size(100, 100);
- carImg.ImageLocation = imagePath;
- carPanel.Controls.Add(carImg);
- pnlCars.Controls.Add(carPanel);
- }
- private void btnImg_Click(object sender, EventArgs e)
- {
- OpenFileDialog imgDialog = new OpenFileDialog();
- imgDialog.InitialDirectory = "C:\\";
- if (imgDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- imagePath = imgDialog.FileName;
- carImg.ImageLocation = imagePath;
- }
- }
- private void carImg_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement