epaitz-esristaff

How to center a modeless .Net Form in ArcMap

Discussion created by epaitz-esristaff Employee on Jun 9, 2010
Latest reply on Aug 5, 2010 by richard_coleman
I am able to setup the owner of the form so that the modeless dialog will minimize with ArcMap and stay ontop of ONLY ArcMap but I am unable to get a modeless dialog to center on ArcMap even when I have its StartupPosition set to CenterParent. I have tried the following:

public override void onCreate(object hook) {
     m_pApplication = hook as IApplication
}

public override void OnClick() {
     IntPtr pIntPtr = new IntPtr(m_pApplication.hWnd);
     MyForm pMyForm = new MyForm();
     pMyForm.Show((System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(pIntPrt);
}


Maybe the CenterParent property does not apply to a Modeless Form?

Thanks,
   -eric

Outcomes