471,334 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,334 software developers and data experts.

Form.ClientSize inconsistently firing Resize event

We have form that is used as the base class of all of our forms, let's
call it BaseApplicationForm. We have another form, say
ChildApplicationForm that inherits from BaseApplicationForm.

The child form implements an event handler for the Resize event.
Inside BaseApplicationForm.InitializeComponent, this.ClientSize is set
to a value. On most of our developers' machines, this.ClientSize =
....; does NOT fire the Resize event, which makes us happy, because the
object isn't finished being constructed yet, and our Resize event
handler should be able to assume that the object it is resizing, you
know, actually exists yet.

The problem is that on 2 of our developer machines, "this.ClientSize =
....;" DOES fire the event.

So, on these two troublesome machines, here is the order of events we
see as we step through:

We step to the very start of the ChildApplicationForm constructor.
This constructor contains a call to its own InitializeComponent, but of
course that won't be executed until the base constructor is executed in
full. So we step, which jumps to the base class constructor. Stepping
through the base class constructor, we arrive at the "this.ClientSize =
....;" line, and rather than moving to the next line, it jumps to the
CHILD class resize event handler. Inside that handler, we refer to
member variables (controls) that are still null, since
ChildApplicationForm.InitializeComponent has yet to be called.

For the rest of us, the event never fires during construction, so
everything works fine.

So, here are my questions: In this parent class / child class
situation, when the parent class' constructor tries to set
this.ClientSize, *should* the resize event be fired? If so, why does
it not do so for most of us. If not, why does it ever get fired for
some of us?

Jan 17 '06 #1
0 1654

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Saso Zagoranski | last post: by
3 posts views Thread by Lionel | last post: by
4 posts views Thread by - Dan - | last post: by
3 posts views Thread by Xwire | last post: by
6 posts views Thread by Rob | last post: by
6 posts views Thread by =?Utf-8?B?bGpsZXZlbmQy?= | last post: by
3 posts views Thread by Tsahi Asher | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.