How to capture Add Control event on design time?

  • Thread starter Thread starter rizwanahmed24
  • Start date Start date
R

rizwanahmed24

Hello

I want to capture the event generated when a control (from toolbox) is
added on to the panel at design time. I tried overriding OnControlAdded
method, and capturing ControlAdded event but its not working.

here are the steps:

1. Create a Panel
2. Add the panel to the form (not necessary)
3. Compile
4. Add a control e.g. Button, from toolbox on to the panel

How can i capture this event at design time.

For error reproducing you can download sample project from following
link:
http://download.yousendit.com/1348E4247660593F

Regards
//Rizwan
 
Rizwan,

If you are talking about OnControlAdded method/event that is declared on the
Control class level it won't do it for you. This event is fired when a
control is added as a child control of the one fired the event at runtime.
At design time you need to created a designer for and use
IComponentChangedService and its ComponentAdded event.
 

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

Back
Top