在MDI上安排最小化的子窗口
本文关键字:窗口 最小化 MDI | 更新日期: 2023-09-27 18:11:02
我有一个带有多个子窗口的MDI程序。是否有任何方法可以影响或修改LayoutMdi( MdiLayout.ArrangeIcons)
在窗体中排列最小化子窗口的方式,或者是否有任何方法可以改变最小化子窗口的位置和/或大小(例如以相同的方式,我可以使用SetBounds
更改未最小化子窗口的位置和大小)
From: https://social.msdn.microsoft.com/Forums/windows/en-US/d6014e48-2adb-4096-8bea-94c2f3b1c47c/how-to-change-the-location-of-a-minimized-mdichild-form?forum=winforms
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
public FormA() {
Button btn = new Button { Text = "asdf" };
Controls.Add(btn);
IsMdiContainer = true;
var f1 = new Form { Text = "Form1", TopLevel = false, MdiParent = this};
var f2 = new Form { Text = "Form2", TopLevel = false, MdiParent = this};
var f3 = new Form { Text = "Form3", TopLevel = false, MdiParent = this};
f1.Show();
f2.Show();
f3.Show();
btn.Click += delegate {
//this.LayoutMdi(MdiLayout.ArrangeIcons);
//f1.Bounds = new Rectangle(50, 50, 100, 30);
int top = 100;
SetWindowPos(f1.Handle, IntPtr.Zero, f1.Left, top, f1.Width, f1.Height, 0);
};
}