using Eto.Drawing; using Eto.Forms; using Rhino; using Rhino.Commands; using Rhino.UI; namespace Coyote.Commands { public class TestLukaszCommand : Rhino.Commands.Command { private bool m_checkScrollPosition = false; public override string EnglishName => "TestLukasz"; protected override Result RunCommand(RhinoDoc doc, RunMode mode) { m_checkScrollPosition = !m_checkScrollPosition; var dialog = new TestLukaszDialog(m_checkScrollPosition); var rc = dialog.ShowModal(RhinoEtoApp.MainWindow); return rc == DialogResult.Ok ? Result.Success : Result.Cancel; } } internal class TestLukaszDialog : Dialog { private readonly bool m_checkScrollPosition = false; public TestLukaszDialog(bool checkScrollPosition) { m_checkScrollPosition = checkScrollPosition; var label = new Label { Text = "Some Label", Font = new Font(SystemFont.Default, 20), Size = new Size(300, 300) }; var table = new TableLayout(); table.Rows.Add(new TableRow(new TableCell(label)) { ScaleHeight = true }); var scrollable = new Scrollable() { Height = 200, Width = 200, Content = table }; if (m_checkScrollPosition) scrollable.Scroll += (sender, e) => PrintScrollPosition(e.ScrollPosition); var button = new Button { Text = "Some Button", Font = new Font(SystemFont.Default, 20), Size = new Size(300, 300) }; var content = new TableLayout(); content.Rows.Add(new TableRow(new TableCell(scrollable)) { ScaleHeight = true }); content.Rows.Add(new TableRow(new TableCell(button)) { ScaleHeight = true }); Content = content; } private void PrintScrollPosition(Point point) { RhinoApp.WriteLine("ScrollPosition:" + point.ToString()); } } }