Exemplo n.º 1
0
        private void OpenWindowAutoSizing(ControlBase control, EventArgs args)
        {
            Control.Window window = new Control.Window(this);
            window.Title               = String.Format("Window ({0})", ++m_WindowCount);
            window.Left                = m_Rand.Next(700);
            window.Top                 = m_Rand.Next(400);
            window.Padding             = new Padding(6, 3, 6, 6);
            window.HorizontalAlignment = HorizontalAlignment.Left;
            window.VerticalAlignment   = VerticalAlignment.Top;
            window.Resizing            = Resizing.None;

            VerticalLayout layout = new VerticalLayout(window);

            Control.GroupBox grb = new Control.GroupBox(layout);
            grb.Text = "Auto size";
            layout   = new VerticalLayout(grb);

            {
                Control.Label label = new Control.Label(layout);
                label.Margin = Margin.Six;
                label.Text   = "Label text";

                Control.Button button = new Control.Button(layout);
                button.Margin = Margin.Six;
                button.Text   = "Click Me";
                button.Width  = 200;

                label        = new Control.Label(layout);
                label.Margin = Margin.Six;
                label.Text   = "Hide / Show Label";
                //label.IsCollapsed = true;

                button.Clicked += (s, a) => label.IsCollapsed = !label.IsCollapsed;
            }
        }
Exemplo n.º 2
0
        private void OpenWindowModal(ControlBase control, EventArgs args)
        {
            Control.Window window = new Control.Window(this);
            window.Title               = String.Format("Modal Window ({0})", ++m_WindowCount);
            window.Left                = m_Rand.Next(700);
            window.Top                 = m_Rand.Next(400);
            window.Padding             = new Padding(6, 3, 6, 6);
            window.HorizontalAlignment = HorizontalAlignment.Left;
            window.VerticalAlignment   = VerticalAlignment.Top;
            window.Resizing            = Resizing.None;
            window.MakeModal(true);

            VerticalLayout layout = new VerticalLayout(window);

            Control.GroupBox grb = new Control.GroupBox(layout);
            grb.Text = "Auto size";
            layout   = new VerticalLayout(grb);

            {
                Control.Label label = new Control.Label(layout);
                label.Margin = Margin.Six;
                label.Text   = "Label text";

                Control.Button button = new Control.Button(layout);
                button.Margin = Margin.Six;
                button.Text   = "Button";
                button.Width  = 200;
            }
        }
Exemplo n.º 3
0
        public RadioButton(ControlBase parent)
            : base(parent)
        {
            VerticalLayout layout = new VerticalLayout(this);

            Control.GroupBox group = new Control.GroupBox(layout);
            group.Margin = Margin.Five;
            group.Text   = "Sample radio group";
            {
                Control.RadioButtonGroup rbg = new Control.RadioButtonGroup(group);

                rbg.AddOption("Option 1");
                rbg.AddOption("Option 2");
                rbg.AddOption("Option 3");
                rbg.AddOption("\u0627\u0644\u0622\u0646 \u0644\u062D\u0636\u0648\u0631");

                rbg.SelectionChanged += OnChange;
            }

            {
                EnumRadioButtonGroup <Choices> erbg = new EnumRadioButtonGroup <Choices>(layout);
                erbg.Margin        = Margin.Five;
                erbg.SelectedValue = Choices.HallC;
            }
        }
Exemplo n.º 4
0
        public TabControl(ControlBase parent)
            : base(parent)
        {
            {
                m_DockControl        = new Control.TabControl(this);
                m_DockControl.Margin = Margin.Zero;
                m_DockControl.Width  = 200;
                //m_DockControl.Height = 150;
                m_DockControl.Dock = Dock.Top;

                {
                    Control.Internal.TabButton button = m_DockControl.AddPage("Controls");
                    ControlBase page = button.Page;

                    {
                        Control.GroupBox group = new Control.GroupBox(page);
                        group.Text = "Tab position";
                        Control.RadioButtonGroup radio = new Control.RadioButtonGroup(group);

                        radio.AddOption("Top").Select();
                        radio.AddOption("Bottom");
                        radio.AddOption("Left");
                        radio.AddOption("Right");

                        radio.SelectionChanged += OnDockChange;
                    }
                }

                m_DockControl.AddPage("Red");
                m_DockControl.AddPage("Green");
                m_DockControl.AddPage("Blue");
                m_DockControl.AddPage("Blue");
                m_DockControl.AddPage("Blue");
            }

            {
                Control.TabControl dragMe = new Control.TabControl(this);
                dragMe.Margin = Margin.Five;
                dragMe.Width  = 200;
                dragMe.Dock   = Dock.Top;

                dragMe.AddPage("You");
                dragMe.AddPage("Can");
                dragMe.AddPage("Reorder").SetImage("test16.png");
                dragMe.AddPage("These");
                dragMe.AddPage("Tabs");

                dragMe.AllowReorder = true;
            }
        }
Exemplo n.º 5
0
        ControlBase CreateControls(ControlBase subject, int dock_idx, String name, int x, int y)
        {
            Control.GroupBox gb = new Control.GroupBox(this);
            gb.SetBounds(x, y, 200, 150);
            gb.Text = name;

            Control.Label l_width = new Control.Label(gb);
            l_width.SetSize(35, 15);
            l_width.Text = "Width:";
         
            Control.HorizontalSlider width = new HorizontalSlider(gb);
            width.Name = "Width";
            width.UserData = subject;
            width.Min = 50;
            width.Max = 350;
            width.Value = 100;
            width.SetSize(55, 15);
            width.ValueChanged += WidthChanged;
            Align.PlaceRightBottom(width, l_width);

            Control.Label l_height = new Control.Label(gb);
            l_height.SetSize(35, 15);
            l_height.Text = "Height:";
            Align.PlaceRightBottom(l_height, width, 10);

            Control.HorizontalSlider height = new Control.HorizontalSlider(gb);
            height.Name = "Height";
            height.UserData = subject;
            height.Min = 50;
            height.Max = 350;
            height.Value = 100;
            height.SetSize(55, 15);
            height.ValueChanged += HeightChanged;
            Align.PlaceRightBottom(height, l_height);

            Control.RadioButtonGroup dock = new RadioButtonGroup(gb, "Dock");
            dock.UserData = subject; // store control that we are controlling
            dock.AddOption("Left");
            dock.AddOption("Top");
            dock.AddOption("Right");
            dock.AddOption("Bottom");
            dock.AddOption("Fill");
            dock.SetSelection(dock_idx);
            Align.PlaceDownLeft(dock, l_width, 5);
            //dock.DrawDebugOutlines = true;
            dock.Invalidate();

            Control.Label l_margin = new Control.Label(gb);
            l_margin.Text = "Margin:";
            l_margin.SetBounds(75, 20, 35, 15);
            //Align.PlaceRightBottom(l_margin, dock);
            // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~
            // this is become really cumbersome
            //l_margin.DrawDebugOutlines = true;

            Control.HorizontalSlider margin = new HorizontalSlider(gb);
            margin.Name = "Margin";
            margin.UserData = subject;
            margin.Min = 0;
            margin.Max = 50;
            margin.Value = 10;
            margin.SetSize(55, 15);
            margin.ValueChanged += MarginChanged;
            Align.PlaceRightBottom(margin, l_margin);

            dock.SelectionChanged += DockChanged;

            return gb;
        }
Exemplo n.º 6
0
        Base CreateControls(Control.Base subject, int dock_idx, String name, int x, int y)
        {
            Control.GroupBox gb = new Control.GroupBox(this);
            gb.SetBounds(x, y, 200, 150);
            gb.Text = name;

            Control.Label l_width = new Control.Label(gb);
            l_width.SetSize(35, 15);
            l_width.Text = "Width:";

            Control.HorizontalSlider width = new HorizontalSlider(gb);
            width.Name = "Width";
            width.UserData.Add("test", subject);
            width.Min   = 50;
            width.Max   = 350;
            width.Value = 100;
            width.SetSize(55, 15);
            width.ValueChanged += WidthChanged;
            Align.PlaceRightBottom(width, l_width);

            Control.Label l_height = new Control.Label(gb);
            l_height.SetSize(35, 15);
            l_height.Text = "Height:";
            Align.PlaceRightBottom(l_height, width, 10);

            Control.HorizontalSlider height = new Control.HorizontalSlider(gb);
            height.Name = "Height";
            height.UserData.Add("test", subject);
            height.Min   = 50;
            height.Max   = 350;
            height.Value = 100;
            height.SetSize(55, 15);
            height.ValueChanged += HeightChanged;
            Align.PlaceRightBottom(height, l_height);

            Control.RadioButtonGroup dock = new RadioButtonGroup(gb, "Dock");
            dock.UserData.Add("test", subject); // store control that we are controlling
            dock.AddOption("Left");
            dock.AddOption("Top");
            dock.AddOption("Right");
            dock.AddOption("Bottom");
            dock.AddOption("Fill");
            dock.SetSelection(dock_idx);
            Align.PlaceDownLeft(dock, l_width, 5);
            //dock.DrawDebugOutlines = true;
            dock.Invalidate();

            Control.Label l_margin = new Control.Label(gb);
            l_margin.Text = "Margin:";
            l_margin.SetBounds(75, 20, 35, 15);
            //Align.PlaceRightBottom(l_margin, dock);
            // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~
            // this is become really cumbersome
            //l_margin.DrawDebugOutlines = true;

            Control.HorizontalSlider margin = new HorizontalSlider(gb);
            margin.Name = "Margin";
            margin.UserData.Add("test", subject);
            margin.Min   = 0;
            margin.Max   = 50;
            margin.Value = 10;
            margin.SetSize(55, 15);
            margin.ValueChanged += MarginChanged;
            Align.PlaceRightBottom(margin, l_margin);

            dock.SelectionChanged += DockChanged;

            return(gb);
        }
Exemplo n.º 7
0
        public GroupBox(Base parent) : base(parent)
        {
            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.Text = "Group Box (centered)";
                gb.SetBounds(10, 10, 200, 100);
                //Align.Center(gb);
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 10);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 50);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label. I'm a really long label!";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Two docked Labels (autosized)";
                gb.SetPosition(250, 100);
                Control.Label label1 = new Control.Label(gb);
                label1.AutoSizeToContents = true;
                label1.Text = "I'm a label";
                label1.Dock = Pos.Top;
                Control.Label label2 = new Control.Label(gb);
                label2.AutoSizeToContents = true;
                label2.Text = "I'm a label. I'm a really long label!";
                label2.Dock = Pos.Top;
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Empty (autosized)";
                gb.SetPosition(10, 150);
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(this);
                //Control.Label gb1 = new Control.Label(this);
                gb1.Padding = Padding.Five;
                gb1.Text    = "Yo dawg,";
                gb1.SetPosition(10, 200);
                gb1.SetSize(350, 200);
                //gb1.AutoSizeToContents = true;

                Control.GroupBox gb2 = new Control.GroupBox(gb1);
                gb2.Text    = "I herd";
                gb2.Dock    = Pos.Left;
                gb2.Margin  = Margin.Three;
                gb2.Padding = Padding.Five;
                //gb2.AutoSizeToContents = true;

                Control.GroupBox gb3 = new Control.GroupBox(gb1);
                gb3.Text = "You like";
                gb3.Dock = Pos.Fill;

                Control.GroupBox gb4 = new Control.GroupBox(gb3);
                gb4.Text = "Group Boxes,";
                gb4.Dock = Pos.Top;
                gb4.AutoSizeToContents = true;

                Control.GroupBox gb5 = new Control.GroupBox(gb3);
                gb5.Text = "So I put Group";
                gb5.Dock = Pos.Fill;
                //gb5.AutoSizeToContents = true;

                Control.GroupBox gb6 = new Control.GroupBox(gb5);
                gb6.Text = "Boxes in yo";
                gb6.Dock = Pos.Left;
                gb6.AutoSizeToContents = true;

                Control.GroupBox gb7 = new Control.GroupBox(gb5);
                gb7.Text = "Boxes so you can";
                gb7.Dock = Pos.Top;
                gb7.SetSize(100, 100);

                Control.GroupBox gb8 = new Control.GroupBox(gb7);
                gb8.Text               = "Group Box while";
                gb8.Dock               = Pos.Top;
                gb8.Margin             = Gwen.Margin.Five;
                gb8.AutoSizeToContents = true;

                Control.GroupBox gb9 = new Control.GroupBox(gb7);
                gb9.Text               = "u Group Box";
                gb9.Dock               = Pos.Bottom;
                gb9.Padding            = Gwen.Padding.Five;
                gb9.AutoSizeToContents = true;
            }

            // at the end to apply to all children
            DrawDebugOutlines = true;
        }
Exemplo n.º 8
0
        public GroupBox(Base parent)
            : base(parent)
        {
            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.Text = "Group Box (centered)";
                gb.SetBounds(10, 10, 200, 100);
                //Align.Center(gb);
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 10);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "With Label (autosized)";
                gb.SetPosition(250, 50);
                Control.Label label = new Control.Label(gb);
                label.AutoSizeToContents = true;
                label.Text = "I'm a label. I'm a really long label!";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Two docked Labels (autosized)";
                gb.SetPosition(250, 100);
                Control.Label label1 = new Control.Label(gb);
                label1.AutoSizeToContents = true;
                label1.Text = "I'm a label";
                label1.Dock = Pos.Top;
                Control.Label label2 = new Control.Label(gb);
                label2.AutoSizeToContents = true;
                label2.Text = "I'm a label. I'm a really long label!";
                label2.Dock = Pos.Top;
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this);
                gb.AutoSizeToContents = true;
                gb.Text = "Empty (autosized)";
                gb.SetPosition(10, 150);
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(this);
                //Control.Label gb1 = new Control.Label(this);
                gb1.Padding = Padding.Five;
                gb1.Text = "Yo dawg,";
                gb1.SetPosition(10, 200);
                gb1.SetSize(350, 200);
                //gb1.AutoSizeToContents = true;

                Control.GroupBox gb2 = new Control.GroupBox(gb1);
                gb2.Text = "I herd";
                gb2.Dock = Pos.Left;
                gb2.Margin = Margin.Three;
                gb2.Padding = Padding.Five;
                //gb2.AutoSizeToContents = true;

                Control.GroupBox gb3 = new Control.GroupBox(gb1);
                gb3.Text = "You like";
                gb3.Dock = Pos.Fill;

                Control.GroupBox gb4 = new Control.GroupBox(gb3);
                gb4.Text = "Group Boxes,";
                gb4.Dock = Pos.Top;
                gb4.AutoSizeToContents = true;

                Control.GroupBox gb5 = new Control.GroupBox(gb3);
                gb5.Text = "So I put Group";
                gb5.Dock = Pos.Fill;
                //gb5.AutoSizeToContents = true;

                Control.GroupBox gb6 = new Control.GroupBox(gb5);
                gb6.Text = "Boxes in yo";
                gb6.Dock = Pos.Left;
                gb6.AutoSizeToContents = true;

                Control.GroupBox gb7 = new Control.GroupBox(gb5);
                gb7.Text = "Boxes so you can";
                gb7.Dock = Pos.Top;
                gb7.SetSize(100, 100);

                Control.GroupBox gb8 = new Control.GroupBox(gb7);
                gb8.Text = "Group Box while";
                gb8.Dock = Pos.Top;
                gb8.Margin = Gwen.Margin.Five;
                gb8.AutoSizeToContents = true;

                Control.GroupBox gb9 = new Control.GroupBox(gb7);
                gb9.Text = "u Group Box";
                gb9.Dock = Pos.Bottom;
                gb9.Padding = Gwen.Padding.Five;
                gb9.AutoSizeToContents = true;
            }

            // at the end to apply to all children
            DrawDebugOutlines = true;
        }
Exemplo n.º 9
0
        public GroupBox(ControlBase parent)
            : base(parent)
        {
            Control.Layout.GridLayout layout = new Control.Layout.GridLayout(this);
            layout.ColumnCount = 2;

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.Size = new Size(200, 100);
                gb.Text = "Group Box";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "With Label (autosized)";
                Control.Label label = new Control.Label(gb);
                label.Dock = Dock.Fill;
                label.Text = "I'm a label";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "With Label (autosized)";
                Control.Label label = new Control.Label(gb);
                label.Dock = Dock.Fill;
                label.Text = "I'm a label. I'm a really long label!";
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "Two docked Labels (autosized)";
                Control.ControlBase gbl    = new Control.Layout.DockLayout(gb);
                Control.Label       label1 = new Control.Label(gbl);
                label1.Text = "I'm a label";
                label1.Dock = Dock.Top;
                Control.Label label2 = new Control.Label(gbl);
                label2.Text = "I'm a label. I'm a really long label!";
                label2.Dock = Dock.Top;
            }

            {
                Control.GroupBox gb = new Control.GroupBox(layout);
                gb.HorizontalAlignment = HorizontalAlignment.Left;
                gb.VerticalAlignment   = VerticalAlignment.Top;
                gb.Text = "Empty (autosized)";
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(layout);
                gb1.HorizontalAlignment = HorizontalAlignment.Left;
                gb1.VerticalAlignment   = VerticalAlignment.Top;
                gb1.Padding             = Padding.Five;
                gb1.Text = "Yo dawg,";
                Control.ControlBase gb1l = new Control.Layout.DockLayout(gb1);

                Control.GroupBox gb2 = new Control.GroupBox(gb1l);
                gb2.Text    = "I herd";
                gb2.Dock    = Dock.Left;
                gb2.Margin  = Margin.Three;
                gb2.Padding = Padding.Five;

                Control.GroupBox gb3 = new Control.GroupBox(gb1l);
                gb3.Text = "You like";
                gb3.Dock = Dock.Fill;
                Control.ControlBase gb3l = new Control.Layout.DockLayout(gb3);

                Control.GroupBox gb4 = new Control.GroupBox(gb3l);
                gb4.Text = "Group Boxes,";
                gb4.Dock = Dock.Top;

                Control.GroupBox gb5 = new Control.GroupBox(gb3l);
                gb5.Text = "So I put Group";
                gb5.Dock = Dock.Fill;
                Control.ControlBase gb5l = new Control.Layout.DockLayout(gb5);

                Control.GroupBox gb6 = new Control.GroupBox(gb5l);
                gb6.Text = "Boxes in yo";
                gb6.Dock = Dock.Left;

                Control.GroupBox gb7 = new Control.GroupBox(gb5l);
                gb7.Text = "Boxes so you can";
                gb7.Dock = Dock.Top;
                Control.ControlBase gb7l = new Control.Layout.DockLayout(gb7);

                Control.GroupBox gb8 = new Control.GroupBox(gb7l);
                gb8.Text   = "Group Box while";
                gb8.Dock   = Dock.Top;
                gb8.Margin = Gwen.Margin.Five;

                Control.GroupBox gb9 = new Control.GroupBox(gb7l);
                gb9.Text    = "u Group Box";
                gb9.Dock    = Dock.Bottom;
                gb9.Padding = Gwen.Padding.Five;
            }
        }
Exemplo n.º 10
0
        public GroupBox(Base parent) : base(parent)
        {
            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    Text = "Group Box (centered)"
                };
                gb.SetBounds(10, 10, 200, 100);
                //Align.Center(gb);
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "With Label (autosized)"
                };
                gb.SetPosition(250, 10);
                Control.Label label = new Control.Label(gb)
                {
                    Text = "I'm a label"
                };
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "With Label (autosized)"
                };
                gb.SetPosition(250, 50);
                Control.Label label = new Control.Label(gb)
                {
                    Text = "I'm a label. I'm a really long label!"
                };
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "Two docked Labels (autosized)"
                };
                gb.SetPosition(250, 100);
                Control.Label label1 = new Control.Label(gb)
                {
                    Text = "I'm a label",
                    Dock = Pos.Top
                };
                Control.Label label2 = new Control.Label(gb)
                {
                    Text = "I'm a label. I'm a really long label!",
                    Dock = Pos.Top
                };
            }

            {
                Control.GroupBox gb = new Control.GroupBox(this)
                {
                    AutoSizeToContents = true,
                    Text = "Empty (autosized)"
                };
                gb.SetPosition(10, 150);
            }

            {
                Control.GroupBox gb1 = new Control.GroupBox(this)
                {
                    //Control.Label gb1 = new Control.Label(this);
                    Padding = Padding.Five,
                    Text    = "Yo dawg,"
                };
                gb1.SetPosition(10, 200);
                gb1.SetSize(350, 200);
                //gb1.AutoSizeToContents = true;

                Control.GroupBox gb2 = new Control.GroupBox(gb1)
                {
                    Text    = "I herd",
                    Dock    = Pos.Left,
                    Margin  = Margin.Three,
                    Padding = Padding.Five
                };
                //gb2.AutoSizeToContents = true;

                Control.GroupBox gb3 = new Control.GroupBox(gb1)
                {
                    Text = "You like",
                    Dock = Pos.Fill
                };

                Control.GroupBox gb4 = new Control.GroupBox(gb3)
                {
                    Text = "Group Boxes,",
                    Dock = Pos.Top,
                    AutoSizeToContents = true
                };

                Control.GroupBox gb5 = new Control.GroupBox(gb3)
                {
                    Text = "So I put Group",
                    Dock = Pos.Fill
                };
                //gb5.AutoSizeToContents = true;

                Control.GroupBox gb6 = new Control.GroupBox(gb5)
                {
                    Text = "Boxes in yo",
                    Dock = Pos.Left,
                    AutoSizeToContents = true
                };

                Control.GroupBox gb7 = new Control.GroupBox(gb5)
                {
                    Text = "Boxes so you can",
                    Dock = Pos.Top
                };
                gb7.SetSize(100, 100);

                Control.GroupBox gb8 = new Control.GroupBox(gb7)
                {
                    Text               = "Group Box while",
                    Dock               = Pos.Top,
                    Margin             = Gwen.Margin.Five,
                    AutoSizeToContents = true
                };

                Control.GroupBox gb9 = new Control.GroupBox(gb7)
                {
                    Text               = "u Group Box",
                    Dock               = Pos.Bottom,
                    Padding            = Gwen.Padding.Five,
                    AutoSizeToContents = true
                };
            }


            // at the end to apply to all children
            DrawDebugOutlines = true;
        }
Exemplo n.º 11
0
        ControlBase CreateControls(Control.ControlBase subject, Dock docking, string name, ControlBase container)
        {
            Control.GroupBox gb = new Control.GroupBox(container);
            gb.Text = name;
            {
                HorizontalLayout hlayout = new HorizontalLayout(gb);
                {
                    Control.GroupBox dgb = new Control.GroupBox(hlayout);
                    dgb.Text = "Dock";
                    {
                        Control.RadioButtonGroup dock = new RadioButtonGroup(dgb);
                        dock.UserData = subject;
                        dock.AddOption("Left", null, Dock.Left);
                        dock.AddOption("Top", null, Dock.Top);
                        dock.AddOption("Right", null, Dock.Right);
                        dock.AddOption("Bottom", null, Dock.Bottom);
                        dock.AddOption("Fill", null, Dock.Fill);
                        dock.SelectByUserData(docking);
                        dock.SelectionChanged += DockChanged;
                    }

                    VerticalLayout vlayout = new VerticalLayout(hlayout);
                    {
                        HorizontalLayout hlayout2 = new HorizontalLayout(vlayout);
                        {
                            Control.GroupBox hgb = new Control.GroupBox(hlayout2);
                            hgb.Text = "H. Align";
                            {
                                Control.RadioButtonGroup halign = new RadioButtonGroup(hgb);
                                halign.UserData = subject;
                                halign.AddOption("Left", null, HorizontalAlignment.Left);
                                halign.AddOption("Center", null, HorizontalAlignment.Center);
                                halign.AddOption("Right", null, HorizontalAlignment.Right);
                                halign.AddOption("Stretch", null, HorizontalAlignment.Stretch);
                                halign.SelectByUserData(subject.HorizontalAlignment);
                                halign.SelectionChanged += HAlignChanged;
                            }

                            Control.GroupBox vgb = new Control.GroupBox(hlayout2);
                            vgb.Text = "V. Align";
                            {
                                Control.RadioButtonGroup valign = new RadioButtonGroup(vgb);
                                valign.UserData = subject;
                                valign.AddOption("Top", null, VerticalAlignment.Top);
                                valign.AddOption("Center", null, VerticalAlignment.Center);
                                valign.AddOption("Bottom", null, VerticalAlignment.Bottom);
                                valign.AddOption("Stretch", null, VerticalAlignment.Stretch);
                                valign.SelectByUserData(subject.VerticalAlignment);
                                valign.SelectionChanged += VAlignChanged;
                            }
                        }

                        Control.Layout.GridLayout glayout = new Control.Layout.GridLayout(vlayout);
                        glayout.SetColumnWidths(Control.Layout.GridLayout.AutoSize, Control.Layout.GridLayout.Fill);
                        {
                            Control.Label l_width = new Control.Label(glayout);
                            l_width.Text = "Width:";

                            Control.HorizontalSlider width = new HorizontalSlider(glayout);
                            width.Name          = "Width";
                            width.UserData      = subject;
                            width.Min           = 50;
                            width.Max           = 350;
                            width.Value         = 100;
                            width.ValueChanged += WidthChanged;

                            Control.Label l_height = new Control.Label(glayout);
                            l_height.Text = "Height:";

                            Control.HorizontalSlider height = new Control.HorizontalSlider(glayout);
                            height.Name          = "Height";
                            height.UserData      = subject;
                            height.Min           = 50;
                            height.Max           = 350;
                            height.Value         = 100;
                            height.ValueChanged += HeightChanged;

                            Control.Label l_margin = new Control.Label(glayout);
                            l_margin.Text = "Margin:";

                            Control.HorizontalSlider margin = new HorizontalSlider(glayout);
                            margin.Name          = "Margin";
                            margin.UserData      = subject;
                            margin.Min           = 0;
                            margin.Max           = 50;
                            margin.Value         = 0;
                            margin.ValueChanged += MarginChanged;
                        }
                    }
                }
            }

            return(gb);
        }