public RenderTriangles() { var spliter = new Splitter() { SplitterBackground = Color.Gray, SplitterDistance = 200 }; AddChild(spliter); var leftSideTopToBottom = new FlowLayoutWidget() { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch, }; spliter.Panel1.AddChild(leftSideTopToBottom); textWidget = new TextEditWidget(pixelWidth: 200) { VAnchor = VAnchor.Stretch, HAnchor = HAnchor.Stretch, Multiline = true, Margin = 3, }; leftSideTopToBottom.AddChild(textWidget); spliter.AddChild(new VerticalLine()); var triangleRenderer = new TriangleRenderer() { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch }; spliter.Panel2.AddChild(triangleRenderer); textWidget.TextChanged += (sender, e) => { var poly = new List <Vector2>(); var polygons = new List <List <Vector2> >(); polygons.Add(poly); var lines = textWidget.Text.Split('\n'); foreach (var line in lines) { if (string.IsNullOrEmpty(line)) { poly = new List <Vector2>(); polygons.Add(poly); } else { var parts = line.Split(','); if (parts.Length == 2) { if (double.TryParse(parts[0], out double x) && double.TryParse(parts[1], out double y)) { poly.Add(new Vector2(x, y)); } } } } triangleRenderer.Polygons = polygons; SaveFile(); Invalidate(); }; textWidget.Text = LoadFile(); triangleRenderer.Invalidate(); AnchorAll(); }