6

这有点令人沮丧,我一直在处理一个应用程序,突然间我无法通过将鼠标移动到表单边缘来调整它的大小。我可以使用标准按钮最大化和最小化。

我在用FormBorderStyle = Sizable;

我已经检查了每个属性,但似乎无法弄清楚我一定是意外更改了哪些属性。我也可以使用 Win+Left 和 Right 来调整表单的大小。对于我的生活,我无法弄清楚是什么原因造成的。

这是下面的代码

namespace WindowsFormsApplication1
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // Form1
            // 
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.ClientSize = new System.Drawing.Size(778, 545);
            this.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Margin = new System.Windows.Forms.Padding(4);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }

        #endregion


    }
}
4

1 回答 1

9

正如我在评论中所说,这是问题所在:

this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;

AutoSize应该是假的,不需要你可以在这里AutoSizeMode 找到更多信息

注意:不要像这样编辑问题

“我找到了答案:……”

您应该将其设置回带有代码的版本。

于 2013-06-19T07:15:40.543 回答