我有一个带有多个子窗口的MDI程序。有什么方法可以影响或修改LayoutMdi( MdiLayout.ArrangeIcons)
在表单中排列最小化子窗口的方式,或者有什么方法可以改变最小化子窗口的位置和/或大小(例如,在同一种类型的窗口中)我可以使用SetBounds
)
答案 0 :(得分:1)
[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);
};
}