I wanted the center of the form to appear in the mouse position, but every time it appeared it was in the bottom right corner of the mouse, and I didn’t quite understand why
Here’s the code I tried:
import Rhino
import Eto.Forms as ef
import Eto.Drawing as ed
screenPos = Rhino.UI.MouseCursor.Location
sp_1_x = screenPos[0] - 100
sp_2_Y = screenPos[1] - 100
form = ef.Form()
form.Location = ed.Point(sp_1_x, sp_2_Y)
form.Width = 100
form.Height = 100
form.Show()
print(screenPos)
Eto.Forms uses logical pixel co-ordinates, whereas Rhino.UI.MouseCursor.Location is in physical pixel co-ordinates. You can either use Eto.Forms.Mouse.Position instead, or use Rhino.UI.EtoExtensions.ToEtoScreen() and ToSystemDrawingScreen() to convert screen co-ordinates from/to Eto.