views:

21

answers:

1

I've got a windows form object that contains 3 objects, a treeview, a richtextbox, and a tabcontrol. They are not docked into the windows form, but they are anchored (top+left).

I've written the code to resize them when a form-resize event handler gets called, but it only seems to be working for an increase of form size, that is to say, I can't resize the form to a smaller size. This includes times when I first increase the main windows form and then attempt to return it to its original size.

The sizes of the three objects are manually set after each Form resize with the code below:

        treeView1.Height += (this.Height - oldHeight);
        richTextBox1.Width += (this.Width - oldWidth);
        tabControl1.Width += (this.Width - oldWidth);
        tabControl1.Height += (this.Height - oldHeight);
        oldHeight = this.Height;
        oldWidth = this.Width;

None of the objects have a set minimum size (they are all at 0,0 throughout the resizing process)

What is preventing the form from being resized to a smaller size?

+1  A: 

Autosize (which was set on the main Form object) was preventing the window from decreasing to a size smaller than the objects contained within it. As the objects within the main Form increased on each expansive resize, the main Form was unable to shrink after any resize growth. By disabling Autosize on the main Form object, I was able to regain full control of resizing.

Maixy