好的,我已经在我的机器上进行了测试,所以我知道它可以工作。但是您可能需要稍作修改才能为您的窗口获取正确的坐标。在下面的实例中,我使用了 ShowModalDialog。但是 ShowModalWindow 应该类似地工作。
第 1 步:
更改表单属性 >> 开始位置:手动
第2步:
使用不同的重载方法:(意思是,将persistSizeAndPosition更改为False,这就是全部技巧)
Dim LineForm As New frmLineDsgn
LineForm.Left = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Left + 5
LineForm.Top = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Top + 5
Application.ShowModalDialog(LineForm.Handle,LineForm,False)
看起来这个问题以前在 AutoCAD 论坛上被问过:Tony Tanzillo 有一个很好的答案(值得称赞):
http ://forums.autodesk.com/t5/NET/ShowModalDialog-question/td-p/1744220
您将需要使用不同的重载方法:
Public Shared Function ShowModalWindow(ByVal owner As System.Windows.Window,
ByVal formToShow As System.Windows.Window,
ByVal persistSizeAndPosition As Boolean) As Boolean?
Member of Autodesk.AutoCAD.ApplicationServices.Application
Public Shared Function ShowModalDialog(ByVal owner As System.Windows.Forms.IWin32Window,
ByVal formToShow As System.Windows.Forms.Form,
ByVal persistSizeAndPosition As Boolean) As System.Windows.Forms.DialogResult
Member of Autodesk.AutoCAD.ApplicationServices.Application