C# WinForm 定位顯示 [如何將表單 (Windows Forms .net) 位置和大小]
C# WinForm 定位顯示 [如何將表單 (Windows Forms .net) 位置和大小]
資料來源: https://docs.microsoft.com/zh-tw/dotnet/desktop/winforms/forms/how-to-position-and-resize?view=netdesktop-6.0
Code
form.StartPosition = FormStartPosition.Manual; form.Location = new Point(parentForm.Width / 2 - form.Width / 2 + parentForm.Location.X, parentForm.Height / 2 - form.Height / 2 + parentForm.Location.Y); form.Show();