//get primary render element
            public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
            {
                if (!this.HasReadyRenderElement)
                {
                    int gridW = this.Width - 10;
                    int gridH = this.Height - 10;
                    if (gridW < 3)
                    {
                        gridW = 3;
                    }
                    if (gridH < 3)
                    {
                        gridH = 3;
                    }

                    gridBox = new LayoutFarm.CustomWidgets.GridBox(gridW, gridH);
                    gridBox.SetLocation(5, 5);
                    gridBox.BuildGrid(3, 3, CellSizeStyle.UniformCell);

                    var renderE = base.GetPrimaryRenderElement(rootgfx);

                    renderE.AddChild(gridBox);
                    //------------------------------------------------------
                    renderE.AddChild(boxLeftTop);
                    renderE.AddChild(boxRightTop);
                    renderE.AddChild(boxLeftBottom);
                    renderE.AddChild(boxRightBottom);
                    //------------------------------------------------------
                }
                return(base.GetPrimaryRenderElement(rootgfx));
            }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //grid0
            {
                var gridBox = new LayoutFarm.CustomWidgets.GridBox(100, 100);
                gridBox.SetLocation(50, 50);
                gridBox.BuildGrid(2, 4, CellSizeStyle.UniformCell);
                viewport.AddContent(gridBox);
            }
            //grid1
            {
                var gridBox = new LayoutFarm.CustomWidgets.GridBox(100, 100);
                gridBox.SetLocation(200, 50);
                gridBox.BuildGrid(2, 4, CellSizeStyle.UniformCell);

                viewport.AddContent(gridBox);

                var simpleButton = new LayoutFarm.CustomWidgets.SimpleBox(20, 20);
                simpleButton.BackColor = KnownColors.FromKnownColor(KnownColor.OliveDrab);
                gridBox.AddUI(simpleButton, 1, 1);
            }


            //-----
            //grid2
            {
                var gridBox = new LayoutFarm.CustomWidgets.GridBox(100, 100);
                gridBox.SetLocation(350, 50);
                gridBox.BuildGrid(3, 8, CellSizeStyle.UniformCell);

                viewport.AddContent(gridBox);
            }
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //grid0
            {
                var gridBox = new LayoutFarm.CustomWidgets.GridBox(100, 100);
                gridBox.SetLocation(50, 50);
                gridBox.BuildGrid(2, 4, CellSizeStyle.UniformCell);
                viewport.AddContent(gridBox);
            }
            //grid1
            {
                var gridBox = new LayoutFarm.CustomWidgets.GridBox(100, 100);
                gridBox.SetLocation(200, 50);
                gridBox.BuildGrid(2, 4, CellSizeStyle.UniformCell);
                viewport.AddContent(gridBox);
                var simpleButton = new LayoutFarm.CustomWidgets.SimpleBox(20, 20);
                simpleButton.BackColor = KnownColors.FromKnownColor(KnownColor.OliveDrab);
                gridBox.AddUI(simpleButton, 1, 1);
            }


            //-----
            //grid2
            {
                var gridBox = new LayoutFarm.CustomWidgets.GridBox(100, 100);
                gridBox.SetLocation(350, 50);
                gridBox.BuildGrid(3, 8, CellSizeStyle.UniformCell);
                viewport.AddContent(gridBox);
            }
        }
 //get primary render element
 public override RenderElement GetPrimaryRenderElement()
 {
     if (!this.HasReadyRenderElement)
     {
         gridBox = new LayoutFarm.CustomWidgets.GridBox(30, 30);
         gridBox.SetLocation(5, 5);
         gridBox.BuildGrid(3, 3, CellSizeStyle.UniformCell);
         var myRenderElement = base.GetPrimaryRenderElement() as LayoutFarm.CustomWidgets.CustomRenderBox;
         myRenderElement.AddChild(gridBox);
     }
     return(base.GetPrimaryRenderElement());
 }
 //get primary render element
 public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
 {
     if (!this.HasReadyRenderElement)
     {
         gridBox = new LayoutFarm.CustomWidgets.GridBox(30, 30);
         gridBox.SetLocation(5, 5);
         gridBox.BuildGrid(3, 3, CellSizeStyle.UniformCell);
         var renderE = base.GetPrimaryRenderElement(rootgfx);
         renderE.AddChild(gridBox);
         //------------------------------------------------------
         renderE.AddChild(boxLeftTop);
         renderE.AddChild(boxRightTop);
         renderE.AddChild(boxLeftBottom);
         renderE.AddChild(boxRightBottom);
         //------------------------------------------------------
     }
     return base.GetPrimaryRenderElement(rootgfx);
 }
Exemple #6
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //grid0
            {
                var gridView = new LayoutFarm.CustomWidgets.GridView(100, 100);
                gridView.SetLocation(50, 50);
                gridView.BuildGrid(2, 4, CellSizeStyle.UniformCell);
                viewport.AddContent(gridView);
                gridView.MouseDown += (s1, e1) =>
                {
                };
            }
            //grid1
            {
                var gridView = new LayoutFarm.CustomWidgets.GridView(100, 100);
                gridView.SetLocation(200, 50);
                gridView.BuildGrid(2, 4, CellSizeStyle.UniformCell);
                viewport.AddContent(gridView);
                var simpleButton = new LayoutFarm.CustomWidgets.SimpleBox(20, 20);
                simpleButton.BackColor = KnownColors.FromKnownColor(KnownColor.OliveDrab);
                gridView.SetCellContent(simpleButton, 1, 1);
                gridView.MouseDown += (s1, e1) =>
                {
                };

                simpleButton.MouseDown += (s1, e1) =>
                {
                    var box = (LayoutFarm.CustomWidgets.SimpleBox)s1;
                    box.BackColor = KnownColors.FromKnownColor(KnownColor.OrangeRed);
                };
            }
            ////-----
            //grid2
            {
                var gridView = new LayoutFarm.CustomWidgets.GridView(200, 100);
                gridView.SetLocation(350, 50);
                gridView.BuildGrid(10, 8, CellSizeStyle.UniformCell);
                viewport.AddContent(gridView);
            }

            ////-----
            //grid3
            {
                var gridView = new LayoutFarm.CustomWidgets.GridView(200, 100);
                gridView.SetLocation(50, 250);
                gridView.BuildGrid(10, 8, CellSizeStyle.UniformCell);
                viewport.AddContent(gridView);
            }


            ////-----
            //grid4
            {
                var gridView = new LayoutFarm.CustomWidgets.GridView(800, 400);
                gridView.SetLocation(10, 10);
                gridView.HasSpecificHeight = true;
                gridView.HasSpecificWidth  = true;
                gridView.NeedClipArea      = true;
                gridView.BuildGrid(4, 4, CellSizeStyle.UniformCell);



                var gridBox = new LayoutFarm.CustomWidgets.GridBox(400, 200);
                gridBox.SetLocation(300, 250);
                gridBox.SetGridView(gridView);
                viewport.AddContent(gridBox);
                gridBox.PerformContentLayout();
            }
            ////-----
            //grid5
            {
                var gridView = new LayoutFarm.CustomWidgets.GridView(200, 100);
                gridView.SetLocation(50, 500);
                gridView.BuildGrid(10, 8, CellSizeStyle.ColumnAndRow);
                viewport.AddContent(gridView);
            }
        }
 //get primary render element
 public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
 {
     if (!this.HasReadyRenderElement)
     {
         gridBox = new LayoutFarm.CustomWidgets.GridBox(30, 30);
         gridBox.SetLocation(5, 5);
         gridBox.BuildGrid(3, 3, CellSizeStyle.UniformCell);
         var myRenderElement = base.GetPrimaryRenderElement(rootgfx) as LayoutFarm.CustomWidgets.CustomRenderBox;
         myRenderElement.AddChild(gridBox);
     }
     return base.GetPrimaryRenderElement(rootgfx);
 }