views:

76

answers:

2

I'm looking for a method that I can override in my sub classed Form where all the controls inside the Form are already created and visible at design time?

I've tried OnHandleCreated() and it works as I expected at run time because I need to loop through all controls in a specific Form and do something to do them. However, I would like to see those changes being reflected in design mode but OnHandleCreated() only happens at run time.

I need some sort of reusable code because the changes I'm talking about need to be applied to all the forms in my application and not just one. It's unacceptable to manually duplicate the code for each form.

Any other solution for this?

A: 

Can't you do it in the constructor after InitializeComponent(); ?

Grzenio
I just updated my question above to explain why that is not possible for what I want to achieve.
Nazgulled
+1  A: 

Try handling the Load event and check whether DesignMode is true then run the code you want for the designer.

Brian Ensink
The code is to be ran BOTH at design and run time, I just want to see my changes visible in both modes.
Nazgulled
@Nazgulled. Obviously you don't need to check the DesinMode flag in that case. Did this solution work for you? I had another thought that you could subclass Form to provide your custom handling there then simply derive all your forms from that subclass.
Brian Ensink