开发者

Width not changing when Size changes

开发者 https://www.devze.com 2022-12-30 21:52 出处:网络
I\'ve been doing this for years. But now it\'s just not working. private void Form1_Deactivate(object sender, EventArgs e)

I've been doing this for years. But now it's just not working.

private void Form1_Deactivate(object sender, EventArgs e)
        {
            this.Size = new Size(30, 29);
            txt.Visible = false;
            lbl.Visible = false;
        }

T开发者_StackOverflow中文版he form just does not change Width. But, as above, the 3 controls DO become invisible.

Any suggestions?


Windows have an absolute minimum width of 134 pixels (at least on Windows 7)

To circumvent this minimum, you can set FormBorderStyle to FixedToolWindow or SizableToolWindow. (Or handle Windows messages)


First set the FormBorderStyle to SizableToolWindow then set your own value.

0

精彩评论

暂无评论...
验证码 换一张
取 消