Update: Remade the project and it started working.
I have a Windows Form that looks like this:
I am trying to make a MouseDown
event for each box
. As you can see, the BigBox
user control has a Panel
and a TableLayoutPanel
on top of the Panel. Inside each cell of the TableLayoutPanel
there is a user control called MyBox
, which is just a picture box.
When I try to do a MouseDown
event for box1
, nothing happens. I have this code inside BigBox.cs
:
namespace TestProject.controls
{
public partial class BigBox : UserControl
{
public BigBox()
{
InitializeComponent();
}
private void box1_MouseDown(object sender, MouseEventArgs e)
{
Console.Write("Box1 clicked.");
}
}
}
The console never prints anything. What am I doing wrong? I'm new to C# so I don't fully understand everything. Thanks in advance!