概述 Private Function SetLocation(ByVal insForm As Form) As Point 'Screen.AllScreens[0]是获取当前显示器设备
窗口的第一个 Dim insScreen As Screen = Screen.AllScreens(0) If (Not Me.OwnerForm Is Private Function SetLocation(ByVal insForm As Form) As Point 'Screen.AllScreens[0]是获取当前显示器设备窗口的第一个 Dim insScreen As Screen = Screen.AllScreens(0) If (Not Me.OwnerForm Is nothing) Then '获取控件父窗口的屏幕 insScreen = Screen.FromControl(Me) End If '当前屏幕的宽度 - 子页面的宽度 Dim wIDth As Integer = (insScreen.WorkingArea.WIDth - insForm.WIDth) '当前屏幕的高度 - 子页面的高度 Dim height As Integer = (insScreen.WorkingArea.Height - insForm.Height) '
居中 Dim x As Integer = (insScreen.WorkingArea.X + CInt(Math.Round(CDbl((CDbl(wIDth) / 2))))) Dim y As Integer = (insScreen.WorkingArea.Y + CInt(Math.Round(CDbl((CDbl(height) / 2))))) '启动模式 insForm.Startposition = FormStartposition.Manual '返回 Return New Point(x,y) End Function 总结
以上是内存溢出为你收集整理的VB.Net 设置子窗口在父窗口居中显示全部内容,希望文章能够帮你解决VB.Net 设置子窗口在父窗口居中显示所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
评论列表(0条)