Example #1
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);

            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            viewport.AddContent(box1);


            //--------------------------------
            var box2 = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);

            box2.SetLocation(50, 50);
            viewport.AddContent(box2);


            //1. mouse down
            box1.MouseDown += (s, e) =>
            {
                box1.BackColor = KnownColors.FromKnownColor(KnownColor.DeepSkyBlue);
                box2.Visible   = false;
            };
            box1.MouseUp += (s, e) =>
            {
                box1.BackColor = Color.Red;
                box2.Visible   = true;
            };
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            this.rootgfx = viewport.ViewportControl.RootGfx;
            //--------------------------------

            bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
            bgbox.BackColor = Color.White;
            bgbox.SetLocation(0, 0);
            SetupBackgroundProperties(bgbox);
            viewport.AddContent(bgbox);
            //user box1
            var box1 = new LayoutFarm.CustomWidgets.SimpleBox(150, 150);
            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            SetupActiveBoxProperties(box1);
            bgbox.AddChild(box1);
            var box2 = new LayoutFarm.CustomWidgets.SimpleBox(60, 60);
            box2.BackColor = Color.Yellow;
            box2.SetLocation(50, 50);
            SetupActiveBoxProperties(box2);
            bgbox.AddChild(box2);
            var box3 = new LayoutFarm.CustomWidgets.SimpleBox(60, 60);
            box3.BackColor = Color.OrangeRed;
            box3.SetLocation(200, 80);
            SetupActiveBoxProperties(box3);
            bgbox.AddChild(box3);
            selectionBox = new UISelectionBox(1, 1);
            selectionBox.Visible = false;
            selectionBox.BackColor = Color.FromArgb(80, Color.Green);
            viewport.AddContent(selectionBox);
            SetupSelectionBoxProperties(selectionBox);
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
            bgbox.BackColor = Color.White;
            bgbox.SetLocation(0, 0);
            SetupBackgroundProperties(bgbox);
            viewport.AddContent(bgbox);
            //--------------------------------

            var box1 = new LayoutFarm.CustomWidgets.SimpleBox(150, 150);
            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            //box1.dbugTag = 1;
            SetupActiveBoxProperties(box1);
            viewport.AddContent(box1);
            //--------------------------------
            var box2 = new LayoutFarm.CustomWidgets.SimpleBox(60, 60);
            box2.SetLocation(50, 50);
            //box2.dbugTag = 2;
            SetupActiveBoxProperties(box2);
            viewport.AddContent(box2);
            controllerBox1 = new UIControllerBox(40, 40);
            Color c = KnownColors.FromKnownColor(KnownColor.Yellow);
            controllerBox1.BackColor = new Color(100, c.R, c.G, c.B);
            controllerBox1.SetLocation(200, 200);
            //controllerBox1.dbugTag = 3;
            controllerBox1.Visible = false;
            SetupControllerBoxProperties(controllerBox1);
            viewport.AddContent(controllerBox1);
        }
Example #4
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);

            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            //box1.dbugTag = 1;
            SetupActiveBoxProperties(box1);
            viewport.AddContent(box1);

            var box2 = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);

            box2.SetLocation(50, 50);
            //box2.dbugTag = 2;
            SetupActiveBoxProperties(box2);
            viewport.AddContent(box2);


            controllerBox1 = new UIControllerBox(40, 40);
            Color c = KnownColors.FromKnownColor(KnownColor.Yellow);

            controllerBox1.BackColor = new Color(100, c.R, c.G, c.B);
            controllerBox1.SetLocation(200, 200);
            //controllerBox1.dbugTag = 3;
            controllerBox1.Visible = false;
            SetupControllerBoxProperties(controllerBox1);
            viewport.AddContent(controllerBox1);
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);

            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            //box1.dbugTag = 1;
            SetupActiveBoxProperties(box1);
            viewport.AddContent(box1);
            var box2 = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);

            box2.SetLocation(50, 50);
            //box2.dbugTag = 2;
            SetupActiveBoxProperties(box2);
            viewport.AddContent(box2);
            rectBoxController.Init();
            //------------

            viewport.AddContent(rectBoxController);

            //foreach (var ui in rectBoxController.GetControllerIter())
            //{
            //    viewport.AddContent(ui);
            //}
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            SetupImageList();
            for (int i = 1; i < 5; ++i)
            {
                var textbox = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);
                textbox.SetLocation(i * 40, i * 40);
                viewport.AddContent(textbox);
            }
            //--------------------
            //image box
            //load bitmap with gdi+           
            ImageBinder imgBinder = new ClientImageBinder(null);
            imgBinder.SetImage(LoadBitmap("../../Demo/favorites32.png"));
            var imgBox = new CustomWidgets.ImageBox(imgBinder.Image.Width, imgBinder.Image.Height);
            imgBox.ImageBinder = imgBinder;
            viewport.AddContent(imgBox);
            //--------------------
            //checked box
            int boxHeight = 20;
            int boxY = 50;
            //multiple select
            for (int i = 0; i < 4; ++i)
            {
                var statedBox = new LayoutFarm.CustomWidgets.CheckBox(20, boxHeight);
                statedBox.SetLocation(10, boxY);
                boxY += boxHeight + 5;
                viewport.AddContent(statedBox);
            }
            //-------------------------------------------------------------------------
            //single select 
            boxY += 50;
            for (int i = 0; i < 4; ++i)
            {
                var statedBox = new LayoutFarm.CustomWidgets.CheckBox(20, boxHeight);
                statedBox.SetLocation(10, boxY);
                boxY += boxHeight + 5;
                viewport.AddContent(statedBox);
                statedBox.WhenChecked += (s, e) =>
                {
                    var selectedBox = (LayoutFarm.CustomWidgets.CheckBox)s;
                    if (selectedBox != currentSingleCheckedBox)
                    {
                        if (currentSingleCheckedBox != null)
                        {
                            currentSingleCheckedBox.Checked = false;
                        }
                        currentSingleCheckedBox = selectedBox;
                    }
                };
            }
            //-------------------------------------------------------------------
            //test canvas
            var canvasBox = new MyDrawingCanvas(300, 300);
            canvasBox.SetLocation(400, 150);
            viewport.AddContent(canvasBox);
            //-------------------------------------------------------------------

        }
Example #7
0
        void AddScrollView1(SampleViewport viewport, int x, int y)
        {
            var panel = new LayoutFarm.CustomWidgets.SimpleBox(200, 175);

            panel.NeedClipArea = true;
            panel.SetLocation(x + 30, y + 30);
            panel.BackColor = Color.LightGray;
            viewport.AddContent(panel);
            //-------------------------
            {
                //vertical scrollbar
                var vscbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                vscbar.SetLocation(x + 10, y + 10);
                vscbar.MinValue    = 0;
                vscbar.MaxValue    = 170;
                vscbar.SmallChange = 20;
                viewport.AddContent(vscbar);
                //add relation between viewpanel and scroll bar
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(vscbar.SliderBox, panel);
            }
            //-------------------------
            {
                //horizontal scrollbar
                var hscbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                hscbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                hscbar.SetLocation(x + 30, y + 10);
                hscbar.MinValue    = 0;
                hscbar.MaxValue    = 170;
                hscbar.SmallChange = 20;
                viewport.AddContent(hscbar);
                //add relation between viewpanel and scroll bar
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(hscbar.SliderBox, panel);
            }

            //add content to panel
            for (int i = 0; i < 10; ++i)
            {
                var box1 = new LayoutFarm.CustomWidgets.SimpleBox(400, 30);
                box1.HasSpecificWidth  = true;
                box1.HasSpecificHeight = true;
                box1.BackColor         = Color.OrangeRed;
                box1.SetLocation(i * 20, i * 40);
                panel.AddChild(box1);
            }
            //--------------------------
            panel.PerformContentLayout();
            panel.SetViewport(0, 0);
        }
        void AddScrollView1(SampleViewport viewport, int x, int y)
        {
            var panel = new LayoutFarm.CustomWidgets.SimpleBox(200, 175);
            panel.SetLocation(x + 30, y + 30);
            panel.BackColor = Color.LightGray;
            viewport.AddContent(panel);
            //-------------------------  
            {
                //vertical scrollbar
                var vscbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                vscbar.SetLocation(x + 10, y + 10);
                vscbar.MinValue = 0;
                vscbar.MaxValue = 170;
                vscbar.SmallChange = 20;
                viewport.AddContent(vscbar);
                //add relation between viewpanel and scroll bar 
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(vscbar, panel);
            }
            //-------------------------  
            {
                //horizontal scrollbar
                var hscbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                hscbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                hscbar.SetLocation(x + 30, y + 10);
                hscbar.MinValue = 0;
                hscbar.MaxValue = 170;
                hscbar.SmallChange = 20;
                viewport.AddContent(hscbar);
                //add relation between viewpanel and scroll bar 
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(hscbar, panel);
            }

            //add content to panel
            for (int i = 0; i < 10; ++i)
            {
                var box1 = new LayoutFarm.CustomWidgets.SimpleBox(400, 30);
                box1.HasSpecificWidth = true;
                box1.HasSpecificHeight = true;
                box1.BackColor = Color.OrangeRed;
                box1.SetLocation(i * 20, i * 40);
                panel.AddChild(box1);
            }
            //--------------------------   
            panel.PerformContentLayout();
            panel.SetViewport(0, 0);
        }
Example #9
0
 protected override void OnStartDemo(SampleViewport viewport)
 {
     {
         var box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);
         box1.BackColor = Color.Red;
         box1.SetLocation(10, 10);
         //box1.dbugTag = 1;
         SetupActiveBoxProperties(box1);
         viewport.AddContent(box1);
     }
     //--------------------------------
     {
         var box2 = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);
         box2.SetLocation(50, 50);
         //box2.dbugTag = 2;
         SetupActiveBoxProperties(box2);
         viewport.AddContent(box2);
     }
 }
Example #10
0
 protected override void OnStartDemo(SampleViewport viewport)
 {
     {
         var box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);
         box1.BackColor = Color.Red;
         box1.SetLocation(10, 10);
         //box1.dbugTag = 1;
         SetupActiveBoxProperties(box1);
         viewport.AddContent(box1);
     }
     //--------------------------------
     {
         var box2 = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);
         box2.SetLocation(50, 50);
         //box2.dbugTag = 2;
         SetupActiveBoxProperties(box2);
         viewport.AddContent(box2);
     }
 }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            this.rootgfx  = viewport.ViewportControl.RootGfx;
            //--------------------------------

            bgbox           = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
            bgbox.BackColor = Color.White;
            bgbox.SetLocation(0, 0);
            SetupBackgroundProperties(bgbox);
            viewport.AddContent(bgbox);

            //user box1
            var box1 = new LayoutFarm.CustomWidgets.SimpleBox(150, 150);

            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            SetupActiveBoxProperties(box1);
            bgbox.AddChild(box1);


            var box2 = new LayoutFarm.CustomWidgets.SimpleBox(60, 60);

            box2.BackColor = Color.Yellow;
            box2.SetLocation(50, 50);
            SetupActiveBoxProperties(box2);
            bgbox.AddChild(box2);


            var box3 = new LayoutFarm.CustomWidgets.SimpleBox(60, 60);

            box3.BackColor = Color.OrangeRed;
            box3.SetLocation(200, 80);
            SetupActiveBoxProperties(box3);
            bgbox.AddChild(box3);

            selectionBox           = new UISelectionBox(1, 1);
            selectionBox.Visible   = false;
            selectionBox.BackColor = Color.FromArgb(80, Color.Green);
            viewport.AddContent(selectionBox);
            SetupSelectionBoxProperties(selectionBox);
        }
Example #12
0
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);
     box1.BackColor = Color.Red;
     box1.SetLocation(10, 10);
     viewport.AddContent(box1);
     //--------------------------------
     var box2 = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);
     box2.SetLocation(50, 50);
     viewport.AddContent(box2);
     //1. mouse down         
     box1.MouseDown += (s, e) =>
     {
         box1.BackColor = KnownColors.FromKnownColor(KnownColor.DeepSkyBlue);
         box2.Visible = false;
     };
     box1.MouseUp += (s, e) =>
     {
         box1.BackColor = Color.Red;
         box2.Visible = true;
     };
 }
        void AddScrollView2(SampleViewport viewport, int x, int y)
        {
            var panel = new LayoutFarm.CustomWidgets.SimpleBox(400, 300);

            panel.SetLocation(x + 30, y + 30);
            panel.BackColor         = Color.LightGray;
            panel.ContentLayoutKind = CustomWidgets.BoxContentLayoutKind.VerticalStack;
            viewport.AddContent(panel);

            //-------------------------
            //load images...
            int lastY = 0;

            for (int i = 0; i < 5; ++i)
            {
                var imgbox = new LayoutFarm.CustomWidgets.ImageBox(36, 400);
                //if (!System.IO.File.Exists("../../images/0" + (i + 1) + ".jpg"))
                //{
                //}
                ClientImageBinder binder = new ClientImageBinder("../../images/0" + (i + 1) + ".jpg");
                binder.SetOwner(imgbox);
                binder.SetLazyFunc(LazyImageLoad);

                //if use lazy img load func
                imageContentMan.AddRequestImage(binder);

                imgbox.ImageBinder = binder;
                imgbox.BackColor   = Color.OrangeRed;
                imgbox.SetLocation(0, lastY);

                imgbox.MouseUp += (s, e) =>
                {
                    if (e.Button == UIMouseButtons.Right)
                    {
                        //test remove this imgbox on right mouse click
                        panel.RemoveChild(imgbox);
                    }
                };
                lastY += imgbox.Height + 5;
                panel.AddChild(imgbox);
            }
            //--------------------------
            //panel may need more
            panel.SetViewport(0, 0);

            //-------------------------
            {
                //vertical scrollbar
                var vscbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                vscbar.SetLocation(x + 10, y + 10);
                vscbar.MinValue    = 0;
                vscbar.MaxValue    = lastY;
                vscbar.SmallChange = 20;
                viewport.AddContent(vscbar);
                //add relation between viewpanel and scroll bar
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(vscbar, panel);
            }
            //-------------------------
            {
                //horizontal scrollbar
                var hscbar = new LayoutFarm.CustomWidgets.ScrollBar(300, 15);
                hscbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                hscbar.SetLocation(x + 30, y + 10);
                hscbar.MinValue    = 0;
                hscbar.MaxValue    = 170;
                hscbar.SmallChange = 20;
                viewport.AddContent(hscbar);
                //add relation between viewpanel and scroll bar
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(hscbar, panel);
            }
            panel.PerformContentLayout();
        }
Example #14
0
        void AddScrollView2(SampleViewport viewport, int x, int y)
        {
            var panel = new LayoutFarm.CustomWidgets.SimpleBox(800, 1000);

            panel.NeedClipArea = true;
            panel.SetLocation(x + 10, y + 30);
            panel.BackColor         = Color.LightGray;
            panel.ContentLayoutKind = CustomWidgets.BoxContentLayoutKind.VerticalStack;
            viewport.AddContent(panel);
            //-------------------------
            //load images...

            //check folder before load
            string[] fileNames = new string[0];

            if (System.IO.Directory.Exists("../../Data/imgs"))
            {
                fileNames = System.IO.Directory.GetFiles("../../Data/imgs", "0*.jpg");
            }
            //select only
            int         lastY  = 0;
            ImageBinder binder = viewport.GetImageBinder(fileNames[2]);

            for (int i = 0; i < fileNames.Length * 4; ++i) //5 imgs
            {
                var imgbox = new LayoutFarm.CustomWidgets.ImageBox(36, 400);
                imgbox.ImageBinder = binder;
                imgbox.BackColor   = Color.OrangeRed;
                imgbox.SetLocation(0, lastY);
                imgbox.MouseUp += (s, e) =>
                {
                    if (e.Button == UIMouseButtons.Right)
                    {
                        //test remove this imgbox on right mouse click
                        panel.RemoveChild(imgbox);
                    }
                };
                lastY += imgbox.Height + 5;
                panel.AddChild(imgbox);
            }
            //--------------------------
            //panel may need more
            panel.SetViewport(0, 0);
            //-------------------------
            {
                //vertical scrollbar
                var vscbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                vscbar.SetLocation(x + 10, y + 10);
                vscbar.MinValue    = 0;
                vscbar.MaxValue    = lastY;
                vscbar.SmallChange = 20;
                viewport.AddContent(vscbar);
                //add relation between viewpanel and scroll bar
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(vscbar.SliderBox, panel);
            }
            //-------------------------
            {
                //horizontal scrollbar
                var hscbar = new LayoutFarm.CustomWidgets.ScrollBar(150, 15);
                hscbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                hscbar.SetLocation(x + 30, y + 10);
                hscbar.MinValue    = 0;
                hscbar.MaxValue    = 170;
                hscbar.SmallChange = 20;
                viewport.AddContent(hscbar);
                //add relation between viewpanel and scroll bar
                var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(hscbar.SliderBox, panel);
            }
            panel.PerformContentLayout();
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            SetupImageList(viewport);
            for (int i = 1; i < 5; ++i)
            {
                var textbox = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);
                textbox.SetLocation(i * 40, i * 40);
                viewport.AddContent(textbox);
            }
            //--------------------
            //image box
            //load bitmap with gdi+
            ImageBinder imgBinder = viewport.GetImageBinder2("../../Data/imgs/favorites32.png");

            var imgBox = new CustomWidgets.ImageBox(imgBinder.Image.Width, imgBinder.Image.Height);

            imgBox.ImageBinder = imgBinder;
            viewport.AddContent(imgBox);
            //--------------------
            //checked box
            int boxHeight = 20;
            int boxY      = 50;

            //multiple select
            for (int i = 0; i < 4; ++i)
            {
                var statedBox = new LayoutFarm.CustomWidgets.CheckBox(20, boxHeight);
                statedBox.SetLocation(10, boxY);
                boxY += boxHeight + 5;
                viewport.AddContent(statedBox);
            }
            //-------------------------------------------------------------------------
            //single select
            boxY += 50;
            for (int i = 0; i < 4; ++i)
            {
                var statedBox = new LayoutFarm.CustomWidgets.CheckBox(20, boxHeight);
                statedBox.SetLocation(10, boxY);
                boxY += boxHeight + 5;
                viewport.AddContent(statedBox);
                statedBox.WhenChecked += (s, e) =>
                {
                    var selectedBox = (LayoutFarm.CustomWidgets.CheckBox)s;
                    if (selectedBox != currentSingleCheckedBox)
                    {
                        if (currentSingleCheckedBox != null)
                        {
                            currentSingleCheckedBox.Checked = false;
                        }
                        currentSingleCheckedBox = selectedBox;
                    }
                };
            }
            //-------------------------------------------------------------------
            //test canvas
            var canvasBox = new MyDrawingCanvas(300, 300);

            canvasBox.SetLocation(400, 150);
            viewport.AddContent(canvasBox);
            //-------------------------------------------------------------------
        }
Example #16
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            PaintLab.Svg.SvgParser parser = new SvgParser();
            _backBoard           = new BackDrawBoardUI(400, 400);
            _backBoard.BackColor = Color.White;
            viewport.AddContent(_backBoard);



            box1           = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);
            box1.BackColor = Color.Red;
            box1.SetLocation(10, 10);
            //box1.dbugTag = 1;
            SetupActiveBoxProperties(box1);
            _backBoard.AddChild(box1);

            //----------------------

            //load lion svg
            string file       = @"d:\\WImageTest\\lion.svg";
            string svgContent = System.IO.File.ReadAllText(file);

            WebLexer.TextSnapshot textSnapshot = new WebLexer.TextSnapshot(svgContent);
            parser.ParseDocument(textSnapshot);
            //
            SvgRenderVx svgRenderVx = parser.GetResultAsRenderVx();
            var         uiSprite    = new UISprite(10, 10);

            uiSprite.LoadSvg(svgRenderVx);
            _backBoard.AddChild(uiSprite);
            //--------
            rectBoxController.Init();
            //------------
            viewport.AddContent(rectBoxController);

            //foreach (var ui in rectBoxController.GetControllerIter())
            //{
            //    viewport.AddContent(ui);
            //}

            //--------
            var evListener = new GeneralEventListener();

            uiSprite.AttachExternalEventListener(evListener);


            evListener.MouseDown += (e) =>
            {
                //e.MouseCursorStyle = MouseCursorStyle.Pointer;
                ////--------------------------------------------
                //e.SetMouseCapture(rectBoxController.ControllerBoxMain);
                rectBoxController.UpdateControllerBoxes(box1);
                rectBoxController.Focus();
                //System.Console.WriteLine("click :" + (count++));
            };
            rectBoxController.ControllerBoxMain.KeyDown += (s1, e1) =>
            {
                if (e1.Ctrl && e1.KeyCode == UIKeys.X)
                {
                    //test copy back image buffer from current rect area

#if DEBUG
                    //test save some area
                    int w = rectBoxController.ControllerBoxMain.Width;
                    int h = rectBoxController.ControllerBoxMain.Height;

                    using (DrawBoard gdiDrawBoard = DrawBoardCreator.CreateNewDrawBoard(1, w, h))
                    {
                        gdiDrawBoard.OffsetCanvasOrigin(rectBoxController.ControllerBoxMain.Left, rectBoxController.ControllerBoxMain.Top);
                        _backBoard.CurrentPrimaryRenderElement.CustomDrawToThisCanvas(gdiDrawBoard, new Rectangle(0, 0, w, h));
                        var img2 = new ActualImage(w, h);
                        //copy content from drawboard to target image and save
                        gdiDrawBoard.RenderTo(img2, 0, 0, w, h);

                        img2.dbugSaveToPngFile("d:\\WImageTest\\ddd001.png");
                    }
#endif
                }
            };
        }
 void AddScrollView2(SampleViewport viewport, int x, int y)
 {
     var panel = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
     panel.SetLocation(x + 30, y + 30);
     panel.BackColor = Color.LightGray;
     panel.ContentLayoutKind = CustomWidgets.BoxContentLayoutKind.VerticalStack;
     viewport.AddContent(panel);
     //-------------------------  
     //load images...
     int lastY = 0;
     for (int i = 0; i < 5; ++i)
     {
         var imgbox = new LayoutFarm.CustomWidgets.ImageBox(36, 400);
         //if (!System.IO.File.Exists("../../images/0" + (i + 1) + ".jpg"))
         //{
         //}
         ClientImageBinder binder = new ClientImageBinder("../../images/0" + (i + 1) + ".jpg");
         binder.SetOwner(imgbox);
         binder.SetLazyFunc(LazyImageLoad);
         //if use lazy img load func
         imageContentMan.AddRequestImage(binder);
         imgbox.ImageBinder = binder;
         imgbox.BackColor = Color.OrangeRed;
         imgbox.SetLocation(0, lastY);
         imgbox.MouseUp += (s, e) =>
         {
             if (e.Button == UIMouseButtons.Right)
             {
                 //test remove this imgbox on right mouse click
                 panel.RemoveChild(imgbox);
             }
         };
         lastY += imgbox.Height + 5;
         panel.AddChild(imgbox);
     }
     //--------------------------
     //panel may need more 
     panel.SetViewport(0, 0);
     //-------------------------  
     {
         //vertical scrollbar
         var vscbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
         vscbar.SetLocation(x + 10, y + 10);
         vscbar.MinValue = 0;
         vscbar.MaxValue = lastY;
         vscbar.SmallChange = 20;
         viewport.AddContent(vscbar);
         //add relation between viewpanel and scroll bar 
         var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(vscbar, panel);
     }
     //-------------------------  
     {
         //horizontal scrollbar
         var hscbar = new LayoutFarm.CustomWidgets.ScrollBar(150, 15);
         hscbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
         hscbar.SetLocation(x + 30, y + 10);
         hscbar.MinValue = 0;
         hscbar.MaxValue = 170;
         hscbar.SmallChange = 20;
         viewport.AddContent(hscbar);
         //add relation between viewpanel and scroll bar 
         var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(hscbar, panel);
     }
     panel.PerformContentLayout();
 }