473,231 Members | 1,367 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 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 1817

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Saso Zagoranski | last post by:
Hi! I have a question regarding Windows Forms... Let's say I have two forms... MainForm and FormTwo... is it possible, when I open FormTwo from MainForm, to display FormTwo inside MainForm...
3
by: Lionel | last post by:
In my forms constructor I have the following: this.WindowState = FormWindowState.Maximized; I then try to size some controls based on the size of the maximized form's client area: ...
4
by: - Dan - | last post by:
I have an assembly that opens minimised and uses a notify icon in the system tray. IN the new() I have Me.ShowInTaskbar = False and when the form loads I use Me.WindowState =...
8
by: Matt | last post by:
I've been searching around for a simple way to display a background image in my MDI form's client area. I want to be able to load the image from file on start up and have it resize as the MDI form...
3
by: Xwire | last post by:
Can anyone explain why when i set the .ClientSize of a form, and then check the .ClientSize when the resize event fires, it is slightly off, generally 20(varys) pixels in the height but not...
3
by: BrianDH | last post by:
Hi I have a windows form and with init I have a tab control. How can I get the tab control to resize, Min/Max as the windows form is resized? Thanks
6
by: Rob | last post by:
I need to create a form that will resize only the verticle size of the Form and not the width. So far I'm partial to the following code. Can someone please elaborate the ??? . . . . Const...
6
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to implement the following: If the user clicks on the border of a form, then I want to show a box around the form that represents the form's bounds. As the user moves the mouse only the...
3
by: Tsahi Asher | last post by:
hi, i was trying to save the window size of my app using the generated Settings class of Visual C# 2005 Express. for some reason, the stored size was bigger from the actual size, so each time i...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.