//調用Win32 API
[System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "MoveWindow")]
public static extern bool MoveWindow(System.IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
//打開窗體方法,fileName是的窗體名稱,包含路徑
private void OpenAndSetWindow(String fileName)
{
Process p = new Process();//新建進程
p.StartInfo.FileName = fileName;//設置進程名字
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.Start();
MoveWindow(p.MainWindowHandle, 200, 300, 500, 400, true);
//p.MainWindowHandle是你要移動的窗口的句柄;200,300是移動后窗口左上角的橫縱坐標;500,400是移動后窗口的寬度和高度;true表示移動后的窗口是需要重畫
}