parent notification

M

Martijn

Hi,

Coming from a win32 API background, I am trying to make a (temporary)
transition to C# .NET . I find myself frustrated by knowing the
underlying mechanism, but being unable to invoke it.

What I want is functionality similar to WM_PARENTNOTIFY. My control has
some sub-controls (I chose this approach to have Windows do most of the
house keeping) which I want to move by dragging them. Because of this,
the parent needs to be notified whenever the user clicks one of these
sub-controls.

I have looked into all the properties for Control and UserControl, but
none actually set allow parent notification.

As an alternative I figured I could make my own event to trigger the
parent, but of course I would only want to trigger an event if the parent
has a handler installed, but I have no idea on how to trigger these events
at the parent's side. How can I add an event(handler) to a control?

BTW, the parent is a derivative from the UserControl, and the child from
the PictureBox control.

Thanks for any pointers!
 
M

Marina

Your control should have an event that it raises when the parent needs to be
notified.
The parent then should handle this event if that is what it needs to do.
If the parent does not handle the event, then the event will have fired, but
since there were no listeners for it nothing else would happen.
 
M

Martijn

As an alternative I figured I could make my own event to trigger the
Your control should have an event that it raises when the parent
needs to be notified.

As always, it is just a question of terminology. Using the proper terms
("raise" and "event") I had no problem finding what I was looking for.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top