【发布时间】:2015-07-17 14:24:37
【问题描述】:
在我的应用程序中,有一个特定的表单用于输入日期范围。此表单从应用程序中的许多位置调用,并使用简单的TestDates.ShowDialog() 调用从多个表单调用
我想将所述表单置于调用它的表单(其父级)上。但是,我无法弄清楚如何确定发起呼叫的表单。
下面的代码具有我能想到的所有可能性(作为测试),即 Parent、Owner、MidParent,它们都什么都不是。
Me.Location = New System.Drawing.Point(Me.Owner.Location.X + (Me.MdiParent.Bounds.Width - Me.Width) \ 2, Me.Parent.Location.Y + (MdiParent.Bounds.Height - Me.Height) \ 2)
我无法使用 startposition.Centerparent,因为应用程序进行了一些大小调整,并且调用无法以高 DPI 正确地将 testdate 表单居中。
还有其他方法可以确定打开考试日期表格的呼叫的发起者吗?
【问题讨论】:
-
您缺少 ShowDialog 的一个参数,它比手动操作要容易很多。
-
感谢您的提醒,答案是使用 TestDates.showDialog(Me),它是 Me 或提供已打开表单所有者的表单。
标签: vb.net