A
A
Alexander Dorofeev2015-05-24 11:53:40
C++ / C#
Alexander Dorofeev, 2015-05-24 11:53:40

Why doesn't the event in UserControl work?

I created a User Control, made a Click event for it (I just call the MessageBox), threw it on the form: and nothing happens when I click it. What could be the problem?
Here is the link to the video:
https://youtu.be/6Q0kmiXCANQ

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
f_s_b_37, 2015-05-24
@TechCloud

Judging by the video, you have a panel on the user control. The panel is inherited from the Control class, which is designed in such a way that it does not transfer the window message (event) to the parent control. Try clicking on an area that belongs to your UserControl but is not occupied by the panel. In this case, everything will work.
The main solution in this case is to subscribe to the events of the "upper" controls. In the forehead, the task can be solved by sending a message to the parent with the SendMessage function, but in most cases this is not necessary.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question