The eto window is displayed in the middle of the mouse position

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)

I was wondering if the form was further away from the mouse as you went to the bottom right

Somebody help me. :sob:

Hey @tom33,

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.

4 Likes

Thank you Sir, success, I have memorized the difference

1 Like