user8189013
user8189013

Reputation:

Events are not firing in Docked Panel

I have a panel at top with the dock option 'Top' However events are not firing like;

    private void pnlHeader_MouseClick(object sender, MouseEventArgs e)
    {
        MessageBox.Show("test");
    }

Added event

Red area where i click enter image description here

All others panels are working good which they all are docked too.

What should be the cause?

Upvotes: 0

Views: 54

Answers (1)

thi
thi

Reputation: 81

If your Panel contains other elements, and you're clicking on these elements, then the MouseClick event won't be fired (I just tested that). The solution is to whether put the same MouseClick event on the inner elements, or laying an invisible surface on the Panel in order to get the MouseClick event.

Upvotes: 1

Related Questions