Width not changing when Size changes
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.
精彩评论