Hello,
I wanted to ask if it was possible to draw an outline/contour for the label box?
(I don’t see anything in the properties for this)
Hello,
I wanted to ask if it was possible to draw an outline/contour for the label box?
(I don’t see anything in the properties for this)
Try using a Drawable
to draw outlines (or anything you like).
E.g.
var label = new Label { Text = "Hello" };
var drawable = new Drawable { Content = myLabel };
drawable.Paint += (sender, e) => e.Graphics.DrawRectangle(Colors.Blue, new Rectangle(drawable.Size));
// put drawable somewhere
Hope this helps!
@curtisw ok thanks for reply
@curtisw sorry
I was looking at a wrong link
I’m trying to write some Python code
but the link does not mention such language
by any chance is there a way to do this in Py as well?
strange though, the link I had taken from the guide: Eto forms in Python
Hi All,
this is the best code i managed to write, but it still doesn’t work.
import Rhino #as rh
import System #as sy
import scriptcontext #as sc
import Rhino.UI #as ui
import Eto.Forms #as frm
import Eto.Drawing #as drw
class MyForms(Eto.Forms.Dialog[bool]):
def __init__(self):
self.m_lbl = Eto.Forms.Label(Text = 'Label')
self.m_rct = Eto.Forms.Drawable(Content = self.m_lbl)
self.layout = Eto.Forms.DynamicLayout()
self.layout.Padding = Eto.Drawing.Padding(10)
self.layout.AddRow(self.m_rct)
self.Content = self.layout
self.LoadComplete += self.OnPaints
def OnPaints(self, sender, e):
e.Graphics.DrawRectangle(Eto.Drawing.Color(Eto.Drawing.Colors.Red), Eto.Drawing.Rectangle(self.m_rct))
def RunCommand():
MyForms().ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
RunCommand()
where am i wrong?
Hi @0904, you must assign a Paint event to the drawable not the dialog. Below is an example which seems to work.
ETO_DrawableLabelBorder.py (1.3 KB)
_
c.
thanks @clement
it works perfectly