Eto.Forms.Form.Location with multiple screens

Hi @curtisw,

by default, an Eto.Forms.Dialog opens in the center of the Rhino application. Is there a way to accomplish the same using an Eto.Forms.Form ?

I’ve found that a Form seems to open in random locations and would like to get the same behaviour as for a Dialog. To do this, i try to compute the center location like this:

def GetCenterScreenLocation(self):
    w = self.Screen.WorkingArea.Width 
    h = self.Screen.WorkingArea.Height
    center = Eto.Drawing.Point(
                            int(w/2 - self.ClientSize.Width/2), 
                            int(h/2 - self.ClientSize.Height/2)
                            )
                                
    return center

Using a single screen setup this works, however if a user is running his Rhino on a secondary screen, my Form opens on the primary screen while Dialogs open above Rhino.

thanks,
c.

Hey @clement,

You need to use the screen that the Rhino window is on vs. the screen of the new window. E.g. Rhino.UI.RhinoEtoApp.MainWindow.Screen

3 Likes

thanks for this solution!