Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.

I am creating a ContainerControl that will manage a custom layout scheme. I am trying to do some things such as sizing, docking, anchoring, etc. in the ControlAdded event.

The code works well, and if the process is frozen by a MessageBox I can see that everything works well in the designer, until AFTER the event has fired.

When the event is done firing, THEN default values are assigned to the Control that was added.

Is there some way I can either stop these default values from being assigned after my event, or am I going about this the wrong way?

Thanks.
Posted
Updated 20-Mar-10 11:39am
v2

1 solution

What is resetting the values? Set a breakpoint on a property setter and see who is calling it.

It is probably the designer code of your parent form. If so, you could hook the Control.Load event instead of Control.ControlAdded.

Nick
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900