Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
Ribbon changes Form size during Show()
posted

My problem:

I'm creating a new instance of a Form containing a Ribbon control:

Form2 newForm = new Form2();


I'm then setting the Top, Left, Width and Height properties for the form:

newForm.Location = new Point(layout.Left, layout.Top);

newForm.Size = new Size(layout.Width, layout.Height);


I then show the form:

newForm.Show();

The issue is that the form, when it appears, is NOT the height and width I've set through the Size property.  It's smaller.

When I close the form, I save the current Location and Size.  When I run through this process again, the form opens up ... and it's smaller again than last time.

It seems as though the process of "Show"ing the form is causing the Ribbon to react and resize the form.

What I need is for all of the Ribbon drawing actions etc to take place BEFORE I set the size of the form.  I thought that would happen with the "new"ing of the form, but it's not.

I can't set the size of the form after calling "Show", because then there's visible movement of the form, ie. the user sees the form open at one size, and then change size to the new size.

How can I fix this?  Is there an event or something related to the Ribbon doing it's form drawing, that has an "After" or "Completed" process in which I can force my form size?

Sample project demonstrating the problem attached.

Thanks!

T

Infragistics_Save_Reload_Size_Test.zip