I want to be ale to add an image to a form in runtime using a click from the left mouse button. When I tried the code below, nothing happens. I don't get an error message and the picture doesn't appear where I click. I'm not sure if I'm on the right track or not. I don't know how to start if this isn't how I go about doing this operations.
private void button7_Click(object sender, EventArgs e)
{
Floors floors = new Floors();
floors.ShowDialog();
if(Mouse.LeftButton == MouseButtonState.Pressed)
{
var picture = new PictureBox
{
Name = "pictureBox",
Size = new Size(16, 16),
Location = new Point(100, 100),
Image = Final_Project_1_.Properties.Resources.fire_icon,
};
this.Controls.Add(picture);
}
}