Пример #1
0
        public override void HandleRepaint(ConsoleGui.Interfaces.Drawing.IDrawingContext context)
        {
            var le = new Drawing.TableLayoutEngine(this.Region.Interior);

            le.LayoutRows = 3;
            le.LayoutCols = 3;

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    int k = i * 3 + j;
                    context.DrawThinBorder(le.GetRegion(i, j));
                    context.DrawStringAlligned("Text", le.GetRegion(i, j).Interior, (Drawing.TextAllignment)k);
                }
            }

            base.HandleRepaint(context);
        }
Пример #2
0
        public MainForm()
        {
            this.Region = new ConsoleGui.Drawing.Rect(
                0, 0,
                Console.BufferWidth - 1, Console.BufferHeight - 1);

            var le = new Drawing.TableLayoutEngine(this.Region.Interior);

            le.LayoutCols = 1;
            le.LayoutRows = 5;

            this.HelloLabel = new ConsoleGui.Drawing.ReadOnlyTextbox()
            {
                Text   = "Hello!",
                Region = le.GetRegion(0, 0, 1, 1)
            };

            this.CheckboxList = new ConsoleGui.Drawing.CheckboxList()
            {
                Region = le.GetRegion(1, 0, 4, 1),
                Text   = "Pick Some Items"
            };
            this.CheckboxList.Add(new ConsoleGui.Drawing.CheckBoxItem()
            {
                Text = "Item1"
            });
            this.CheckboxList.Add(new ConsoleGui.Drawing.CheckBoxItem()
            {
                Text = "Item2"
            });
            this.CheckboxList.Add(new ConsoleGui.Drawing.CheckBoxItem()
            {
                Text = "Item3"
            });
            this.CheckboxList.Add(new ConsoleGui.Drawing.CheckBoxItem()
            {
                Text = "Item4"
            });

            this.Controls.Add(HelloLabel);
            this.Controls.Add(CheckboxList);
        }
Пример #3
0
        public static void Testlayout()
        {
            var lm = new Drawing.TableLayoutEngine(new ConsoleGui.Drawing.Rect(
                                                       0, 0, Console.BufferWidth - 1, Console.BufferHeight - 1));

            lm.LayoutRows = 2;
            lm.LayoutCols = 5;

            var lm2 = new Drawing.TableLayoutEngine(lm.GetRegion(0, 0, 1, 5));

            lm2.LayoutRows = 1;
            lm2.LayoutCols = 3;

            var dc = new Drawing.ConsoleDrawingContext();

            dc.DrawThinBorder(lm2.GetRegion(0, 0));
            dc.DrawThinBorder(lm2.GetRegion(0, 1));
            dc.DrawThinBorder(lm2.GetRegion(0, 2));

            dc.DrawThinBorder(lm.GetRegion(1, 0));
            dc.DrawThinBorder(lm.GetRegion(1, 2));
            dc.DrawThinBorder(lm.GetRegion(1, 4));
        }