2
Answers

Form resize not working correctly after upgrading to Framework 1.1

Hi all, I Generic form contains two panels. The lower panel (with fixed height) contains buttons, the upper panel is empty but set to fill the rest of the form space. In this form I have a function to set any User control I want in the upper panel. Then it resizes the form accordingly to see the entire user control and the lower button panel. Here is the function: public void SetControl( Control ctrl ) { _upperPanel.Controls.Add( ctrl ); // Size the window according to the new panel int deltaW = ctrl.Width - _upperPanel.Size.Width; int deltaH = ctrl.Height - _upperPanel.Size.Height; this.Size = new Size( this.Size.Width + deltaW, this.Size.Height + deltaH ); } This was working perfectly with .NET 1.0. However I noticed that after upgrading to .NET 1.1, the height of the form was not working anymore. It was missing a little. What is weird is that the width is resizing correctly. And if I copy the resizing code above (3 last lines) twice in the same function it works. Any ideas? Thanks, Hugo
Answers (2)