tom33
(Ye lin a)
1
I want the eto form position to be aligned to the top left or top right corner of the Rhino view, but I can’t seem to find the right way so far
#! python 3
import Eto.Forms as ef
import Rhino
import Eto.Drawing as ed
import scriptcontext
view = scriptcontext.doc.Views.ActiveView
rt = Rhino.UI.EtoExtensions.ToEtoScreen(view.ClientRectangle)
print(rt.Width)
print(rt.Height)
print(rt.X)
print(rt.Y)
form = ef.Form()
form.Width = 200
form.Height = 100
form.Location = ed.PointF(view.ClientRectangle.X , view.ClientRectangle.Y)
form.Show()
This is the effect I want
I took some inspiration from this
Viewport dimension in world view - Scripting - McNeel Forum
Hi @tom33, below seems to work over here using 2 screens:
#! python 3
import Eto.Forms as ef
import Rhino
import Eto.Drawing as ed
import scriptcontext
view = scriptcontext.doc.Views.ActiveView
rt = Rhino.UI.EtoExtensions.ToEtoScreen(view.ScreenRectangle)
form = ef.Form()
form.Width = 200
form.Height = 100
form.Location = ed.PointF(rt.X , rt.Y)
form.Show()
does it work for you too ?
_
c.
2 Likes
tom33
(Ye lin a)
3
Thank you, this is very helpful
tom33
(Ye lin a)
4

#! python 3
import Eto.Forms as ef
import Rhino
import Eto.Drawing as ed
import scriptcontext
view = scriptcontext.doc.Views.ActiveView
rt = Rhino.UI.EtoExtensions.ToEtoScreen(view.ScreenRectangle)
for i in range(4):
form = ef.Form()
form.Width = 200
form.Height = 100
if i == 1:
form.Location = ed.PointF(rt.X, rt.Y )
form.Title = str(i)
elif i== 2:
form.Location = ed.PointF(rt.X, rt.Y + rt.Height - 100)
form.Title = str(i)
elif i == 3:
form.Location = ed.PointF(rt.X + rt.Width - 200, rt.Y )
form.Title = str(i)
elif i == 0:
form.Location = ed.PointF(rt.X + rt.Width - 200, rt.Y + rt.Height - 100)
form.Title = str(i)
form.Show()
1 Like