1.使用 new form 時就用 .StartPosition = FormStartPosition.CenterScreen
Dim nF As New Form
With nF
.Name = "NewErrForm"
.Text = "庫存異常資料"
.StartPosition = FormStartPosition.CenterScreen
'......
End With
2.或算出螢幕解析與表單相對的 location
With tmpForm
'.MdiParent = frm
Dim xTMP As Integer = (Screen.PrimaryScreen.Bounds.Width - .Width) / 2
Dim yTMP As Integer = (Screen.PrimaryScreen.Bounds.Height - .Height) / 2
.Location = New System.Drawing.Point(xTMP, yTMP)
'......
End With
Dim nF As New Form
With nF
.Name = "NewErrForm"
.Text = "庫存異常資料"
.StartPosition = FormStartPosition.CenterScreen
'......
End With
2.或算出螢幕解析與表單相對的 location
With tmpForm
'.MdiParent = frm
Dim xTMP As Integer = (Screen.PrimaryScreen.Bounds.Width - .Width) / 2
Dim yTMP As Integer = (Screen.PrimaryScreen.Bounds.Height - .Height) / 2
.Location = New System.Drawing.Point(xTMP, yTMP)
'......
End With
沒有留言:
張貼留言