コード例 #1
0
        protected virtual void InitTable()
        {
            MainContainer            = Controls.AddChild(new ScrollableContainer("main", Docking.Fill, new SilverPanelWidgetStyle()));
            MainContainer.AutoScroll = true;
            MainContainer.ScrollBars = ScrollBars.Vertical;

            Table = MainContainer.AddChild(new TableLayoutContainer("table"));

            // this should do the same:
            Table.Padding                 = new Padding(12, 6);
            Table.CellPadding             = new SizeF(12, 6);
            Table.CollapsibleColumnsWidth = 420;

            int row = 0;

            /***
             * Table.AddChild (new TextLabel ("lblGender", "Gender"), row, 0, 1, 2);
             * row++;
             * Table.AddChild (new ComboListBox ("Gender"), row, 0, 1, 2).CastTo<ComboListBox>().Do (cbo => {
             *      cbo.Items.Add("Male", 1);
             *      cbo.Items.Add("Female", 2);
             *      cbo.Items.Add("Not sure", 0);
             *      cbo.SelectedIndex = 0;
             * });
             * row++;
             ***/

            Table.AddChild(new TextLabel("lblFirstName", "First Name"), row, 0, 1, 2);
            Table.AddChild(new TextBox("FirstName"), row + 1, 0, 1, 2);

            Table.AddChild(new TextLabel("lblLastName", "Last Name"), row, 2);
            Table.AddChild(new TextBox("LastName"), row + 1, 2);

            row++;
            row++;
            Table.AddChild(new TextLabel("lblCompany", "Company"), row, 0, 1, 3);
            row++;
            Table.AddChild(new TextBox("Company"), row, 0, 1, 3);

            row++;
            Table.AddChild(new TextLabel("lblZip", "Zip"), row, 0);
            Table.AddChild(new TextBox("Zip"), row + 1, 0);

            Table.AddChild(new TextLabel("lblCity", "City"), row, 1);
            Table.AddChild(new TextBox("City"), row + 1, 1);

            Table.AddChild(new TextLabel("lblAddress", "Street Address"), row, 2);
            Table.AddChild(new TextBox("Address"), row + 1, 2);

            row++;
            row++;

            Table.AddChild(new TextLabel("lblPhone", "Phone"), row, 0, 1, 2);
            Table.AddChild(new ButtonTextBox("Phone", (char)FontAwesomeIcons.fa_phone, null, ColorContexts.Success), row + 1, 0, 1, 2);

            Table.AddChild(new TextLabel("lblEmail", "Email"), row, 2);
            Table.AddChild(new ButtonTextBox("Email", (char)FontAwesomeIcons.fa_envelope_o, null, ColorContexts.Success), row + 1, 2);

            row++;
            row++;
            Table.AddChild(new TextLabel("lblWeb", "Web"), row, 0, 1, 3);
            row++;
            Table.AddChild(new ButtonTextBox("Web", (char)FontAwesomeIcons.fa_chain, null, ColorContexts.Default), row, 0, 1, 3);

            LayoutDirtyFlag    = true;
            Table.AfterLayout += (sender, e) => UpdateTableSize();
        }