How can I resize a .NET container to the embedded window siz

Posted by rbf on 24-Aug-2011 16:12

I have a Progress.Windows.Form that contains an UltraExplorerBar and a WindowContainer.

When I embed a GUI window in the WindowContainer (Dock:Fill) that is too small scrollbars appear.

Then I query the size of the main frame in the embedded window and increase the Form size where necessary.

The Form resizes correctly, but the WindowContainer does not. The scrollbar(s) remain visible and the background of the Form becomes visible in the resized area.

As soon as I manually touch the size of the Form the WindowContainer the WindowContainer fills the Form again and the scrollbars disappear.

So manually it works fine, but programmatically does not work out the same. I have been looking for OnResize or something like that but that does not exist for a Form.

Any ideas?

All Replies

Posted by Wouter Dupré on 24-Aug-2011 16:15

Hi,

Thank you for your email. I'm currently out of the office. I will return on August 29. During my absence I will have no/limited access access to email. For urgent matters, call me on my mobile and leave a message, call our office, or contact Gary Calcott (gcalcott@progress.com).

Best regards,

Wouter

--

Wouter Dupré

Senior Solutions Consultant

Progress Software NV

A. Stocletlaan 202 B | B-2570 Duffel | Belgium

Office +32 (0) 15 30 77 00 | Mobile +32 (0) 478 50 00 49

Posted by Admin on 24-Aug-2011 23:15

Any ideas?

Sounds strange and doesn't occur to me.

Can you share a small sample that illustrates the messy behavior?

Posted by Peter Judge on 25-Aug-2011 07:01

rbf wrote:

So manually it works fine, but programmatically does not work out the same. I have been looking for OnResize or something like that but that does not exist for a Form.

Any ideas?

Peter,

I see a SizeChanged event on both the WindowContainer and Form (they inherit it from the Control - http://msdn.microsoft.com/en-us/library/system.windows.forms.control.sizechanged(v=VS.85).aspx ).

Do you not see those events?

-- peter

Posted by rbf on 25-Aug-2011 16:09

mikefe wrote:

Any ideas?

Sounds strange and doesn't occur to me.

Can you share a small sample that illustrates the messy behavior?

I am busy trying to create a reproduction but have not succeeded yet.

The real program is quite complicated and I am stripping it down.

Maybe I will run into the solution while doing that, will keep you posted.

Posted by rbf on 25-Aug-2011 16:10

pjudge wrote:

rbf wrote:

So manually it works fine, but programmatically does not work out the same. I have been looking for OnResize or something like that but that does not exist for a Form.

Any ideas?

Peter,

I see a SizeChanged event on both the WindowContainer and Form (they inherit it from the Control - http://msdn.microsoft.com/en-us/library/system.windows.forms.control.sizechanged(v=VS.85).aspx ).

Do you not see those events?

-- peter

Peter,

Yes I see those events but I understand in order to raise them from the ABL I need an OnSizeChanged method?!?

-peter

Posted by Admin on 25-Aug-2011 23:00

Yes I see those events but I understand in order to raise them from the ABL I need an OnSizeChanged method?!?

I don't see why you'd need to raise them manually...

Posted by Peter Judge on 26-Aug-2011 07:33

Peter,

Yes I see those events but I understand in order to raise them from the ABL I need an OnSizeChanged method?!?

-peter

Take a look at the last comment in http://www.pcreview.co.uk/forums/onresize-and-onsizechanged-t1313419.html , via http://stackoverflow.com/questions/4499983/onresize-vs-onsizechanged has some interesting info. Summarised, if you change the Size property programatically, the SizeChanged event will fire, to which you can subscribe. The Resize event only fires via Windows messages (ie when the form is manually resized).

-- peter

Posted by Admin on 26-Aug-2011 07:40

But he shouldn't need any of the events when the Form is Docking.

Peter (van Dam), are you overriding any of the event methods (On....) of the Form and not properly calling the SUPER:On.... Method?

Posted by rbf on 26-Aug-2011 08:30

mikefe wrote:

But he shouldn't need any of the events when the Form is Docking.

Peter (van Dam), are you overriding any of the event methods (On....) of the Form and not properly calling the SUPER:On.... Method?

No I don't.

Posted by rbf on 27-Aug-2011 05:17

pjudge wrote:

Peter,

Yes I see those events but I understand in order to raise them from the ABL I need an OnSizeChanged method?!?

-peter

Take a look at the last comment in http://www.pcreview.co.uk/forums/onresize-and-onsizechanged-t1313419.html , via http://stackoverflow.com/questions/4499983/onresize-vs-onsizechanged has some interesting info. Summarised, if you change the Size property programatically, the SizeChanged event will fire, to which you can subscribe. The Resize event only fires via Windows messages (ie when the form is manually resized).

-- peter

I see what you are saying (you are describing my problem) but not how I can solve my problem?!?

Posted by Peter Judge on 29-Aug-2011 18:10

Peter,

Does setting the Size property to some newly calculated value not fire the SizeChanged event?

-- peter

Posted by rbf on 03-Sep-2011 06:36

pjudge wrote:

Peter,

Does setting the Size property to some newly calculated value not fire the SizeChanged event?

-- peter

I just checked and the SizeChanged event fires.

What can I do next?

Posted by Admin on 03-Sep-2011 09:40

Were you able to reproduce this in a sample you can share?

Posted by rbf on 04-Sep-2011 14:56

No I have not been able to produce a simple reproduction.

Posted by rbf on 09-Sep-2011 05:06

Peter the SizeChanged event fires. What can I do now? I am still struggling with this problem.

Posted by rbf on 05-Oct-2011 10:02

For the record, with the help of Mike Fechner this problem has been solved.

The reason for the strange behavior was that in this case the Form became smaller during the Show() method. The decrease in size was equal to the border widths. When I compensated for that everything worked correctly.

Mike and I are not able to explain why this phenomena occurs in my program as it normally does not, but hey, my problem is solved!

This thread is closed