[Quote=引用 18 楼 zwth001 的回复:]
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);
--------------------------……
[/Quote]
这是调用API的C#申明
你需要加上命名空间:
using System.Runtime.InteropServices;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);
-----------------------------------------------
这三行代码是什么意思,是api声明吗?
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);
private void button1_Click(object sender, EventArgs e)
{
Form2 fm = new Form2(); SetWindowPos(fm.Handle,-1, 200, 200, 300, 300,3); fm.ShowDialog();
}