Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我想最小化的示例表单。
这是表单的原始大小:
当它被最小化时,它应该隐藏表单的其他部分,只显示特定区域,应该如下所示:
我应该能够将表单恢复到原始状态,反之亦然。这可能吗?我只尝试过将表单最小化到任务栏,但我没有尝试过这种方法,我想知道这是否可行,因为我发现这个功能非常方便。
只需使用两个面板控件,都使用 Dock = Top。然后只需要两行代码就可以在展开视图和折叠视图之间切换:
panel1.Visible = !panel1.Visible; this.ClientSize = new Size(this.ClientSize.Width, panel2.Bottom);