rfgamaral
rfgamaral

Reputation: 16842

Is there a Form method I can override after all controls are created but visible at design time in .NET?

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?

Upvotes: 1

Views: 207

Answers (2)

Brian Ensink
Brian Ensink

Reputation: 11218

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

Upvotes: 1

Grzenio
Grzenio

Reputation: 36679

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

Upvotes: 0

Related Questions