求帮助

.Net技术 码拜 8年前 (2016-02-29) 907次浏览
为啥本人在代码里改Label控件的大小,并没有改变呀?代码如下:
TextLabel.Size = new Size(999, 999);
PS:这个控件是本人用工具箱拖到窗体里生成的。
解决方案

8

TextLabel.AutoSize = false;
TextLabel.Size = new Size(999, 999);

30

没有任何问题,只需要设置AutoSize = false;

            this.label1.AutoSize = false;
            this.label1.BackColor = System.Drawing.SystemColors.Info;
            this.label1.Location = new System.Drawing.Point(32, 67);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(219, 103);
            this.label1.TabIndex = 0;
            this.label1.Text = "这是个很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长" +
    "很长很长很长很长很长很长很长很长的文字";
        public Form1()
        {
            InitializeComponent();
            this.label1.Size = new Size(30, 30);
        }

2

是不是设置了autosize

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明求帮助
喜欢 (0)
[1034331897@qq.com]
分享 (0)