是什么阻止我调整(缩小)我的 windows 窗体对象? [英] What's preventing me from resizing (downsizing) my windows form object?

查看:86
本文介绍了是什么阻止我调整(缩小)我的 windows 窗体对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 windows 窗体对象,它包含 3 个对象、一个树视图、一个富文本框和一个选项卡控件.它们没有停靠在窗口窗体中,但它们是锚定的(顶部+左侧).

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).

我已经编写了在调用 form-resize 事件处理程序时调整它们大小的代码,但它似乎只适用于增加表单大小,也就是说,我无法将表单大小调整为较小的尺寸.这包括我第一次增加主窗口窗体然后尝试将其恢复到原始大小的时间.

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.

三个对象的大小是在每次 Form resize 后手动设置的,代码如下:

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;

所有对象都没有设定的最小尺寸(在整个调整大小过程中它们都为 0,0)

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?

推荐答案

Autosize(在主 Form 对象上设置)阻止窗口减小到小于其中包含的对象的大小它.随着主窗体内的对象在每次扩展调整大小时增加,主窗体在任何调整大小增长后都无法缩小.通过在主 Form 对象上禁用自动调整大小,我能够重新获得对调整大小的完全控制.

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.

这篇关于是什么阻止我调整(缩小)我的 windows 窗体对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆