Why does ISerialize.EndInit() cause UserControl1_Load() to be called?

  • Thread starter Thread starter Charles Law
  • Start date Start date
C

Charles Law

Can anyone explain the following behaviour?

Create a new, blank project, and place an ActiveX control (e.g. WebBrowser
control) on Form1. Now run the solution.

The sequence of events is:

Form1.New() begins
Form1.New() ends
Form1_Load() called
....

Now create a user control and put the ActiveX control on it. Put the user
control on Form1 instead of the ActiveX control. Now run the solution.

The sequence of events is:

Form1.New() begins
UserControl1. New() begins
UserControl1_Load() begins
UserControl1_Load() ends
UserControl1. New() ends
Form1.New() ends
Form1_Load() called
....

The two behaviours do not seem consistent. Is this what people would expect
to happen?

I would expect something like

Form1.New() begins
UserControl1. New() begins
UserControl1. New() ends
UserControl1_Load() begins
UserControl1_Load() ends
Form1.New() ends
Form1_Load() called
....

TIA

Charles
 
Hi Charles,

If only you could take an Ax to that AxBrowser!! ;-)

I've kept away for fearing giving you the 'Kiss of Death', lol, but it is
the subject matter, I'm afraid.

Again, I have no solution, but there's an article about DesignMode that
may shed a couple of Watts into a murky corner.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/ht
ml/designtimedebugging.asp

I found the Chain of Events part quite illuminating in fact - simulated
InitializeComponent indeed, lol!

Regards,
Fergus
 
Hi Fergus

If I had known when I started what I know now ...

The answer has to be for someone to write a managed wrapper for mshtml and
shdocvw, probably in C#. I know there are some attempts out there, but so
far I haven't found a complete solution that implements all the things that
I have now added to my own control, e.g. visible, sizeable, snappable grid,
visual column and row sizing of tables, and others.

Thanks for the link; I will take a look.

Cheers

Charles
 
Back
Top