473,565 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 BaseApplication Form. We have another form, say
ChildApplicatio nForm that inherits from BaseApplication Form.

The child form implements an event handler for the Resize event.
Inside BaseApplication Form.Initialize Component, 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.ClientSiz e =
....;" 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 ChildApplicatio nForm constructor.
This constructor contains a call to its own InitializeCompo nent, 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.ClientSiz e =
....;" 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
ChildApplicatio nForm.Initializ eComponent 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 1848

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

Similar topics

6
9215
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 instead of in it's own window? Thanks, Saso
3
2169
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: SomeControl.Height = (this.ClientSize).Height; But this never returns the proper value i.e. (this.ClientSize).Height is
4
1341
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 = FormWindowState.Minimized but the form opens sort-of minimised but it minimises to a small bar above the start button. I dont want to see the small bar, i want it...
8
9257
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 is resized. It's the resizing part that I am having trouble with. I've seen a few old posts that point in the right direction but nothing...
3
3085
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 always. I have tried many things to try to get the clientsize to set properly such as setting autoscale to false among other things, but the client size...
3
16101
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
5183
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 WM_SIZE = &H5 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Call MyBase.WndProc(m)
6
1939
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 box's bounds would change. When the user releases the mouse the form's bounds would be set to the bounds of the box. Note that this is very similar...
3
2554
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 start the app, it's bigger than before, until it fills the screen (1024*768). the odd thing is, that it works just fine in the IDE, and if i install...
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.