Exemplo n.º 1
0
        private void CreateTable(ControlBase container)
        {
            TableLayout sp = new TableLayout(container);

            sp.AutoSizeRows = false;
            // sp.DrawDebugOutlines = true;
            sp.AutoSizeToContents = true;
            sp.Dock = Dock.Fill;
            var row = sp.CreateRow();

            CreateButton(row.GetCell(0), "autosize").Clicked += (o, e) =>
            {
                sp.AutoSizeRows = true;
                var txt = ((Button)o).Text;
                if (txt == "short")
                {
                    txt = "much longer";
                }
                else
                {
                    txt = "short";
                }
                ((Button)o).Text = txt;
            };
            CreateButton(row.GetCell(1), "Test 2");
            row = sp.CreateRow();
            CreateButton(row.GetCell(0), "Test 3 --");
            var b = CreateButton(row.GetCell(1), "Tall 4");

            b.SizeToChildren();
            b.AutoSizeToContents = false;
            b.Height             = 50;
            row = sp.CreateRow();
            CreateButton(row.GetCell(0), "no auto").Clicked += (o, e) =>
            {
                sp.AutoSizeRows = false;
                sp.SetColumnWidth(0, 20);
            };
            row = sp.CreateRow();
            row.SetCell(CreateButton(null, "Test 6"), 1);
        }