protected override void OnStartDemo(SampleViewport viewport)
        {
            textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false);
            textbox.SetLocation(20, 20);
            var textSplitter = new Composers.ContentTextSplitter();

            textbox.TextSplitter = textSplitter;


            listView = new CustomWidgets.ListView(300, 200);
            listView.SetLocation(0, 40);
            listView.Visible = false;
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();

            textSurfaceListener.CharacterAdded      += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved    += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            textbox.TextEventListener = textSurfaceListener;
            //------------------------------------
            viewport.AddContent(textbox);
            viewport.AddContent(listView);
            //------------------------------------
            BuildSampleCountryList();
        }
        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);
            //}
        }
        public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
                                                        EventHandler <ContentManagers.ImageRequestEventArgs> imageReqHandler,
                                                        EventHandler <ContentManagers.TextRequestEventArgs> textReq)
        {
            HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost();
            htmlhost.SetRootGraphics(sampleViewport.Root);

            List <HtmlBoxes.HtmlContainer> htmlContUpdateList = new List <HtmlBoxes.HtmlContainer>();

            sampleViewport.Root.ClearingBeforeRender += (s, e) =>
            {
                //1.
                htmlhost.ClearUpdateWaitingCssBoxes();
                //1.
                int j = htmlContUpdateList.Count;
                for (int i = 0; i < j; ++i)
                {
                    var htmlCont = htmlContUpdateList[i];
                    htmlCont.RefreshDomIfNeed();
                    htmlCont.IsInUpdateQueue = false;
                }
                htmlContUpdateList.Clear();
            };
            htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));
            htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
            htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
            {
                if (!htmlCont.IsInUpdateQueue)
                {
                    htmlCont.IsInUpdateQueue = true;
                    htmlContUpdateList.Add(htmlCont);
                }
            });
            return(htmlhost);
        }
Exemple #4
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            ////==================================================
            //html box
            var           htmlHost  = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            var           htmlBox   = new HtmlBox(htmlHost, 800, 400);
            StringBuilder stbuilder = new StringBuilder();

            stbuilder.Append("<html><head></head><body>");
            stbuilder.Append("<div>custom box1</div>");
            stbuilder.Append("<x id=\"my_custombox1\"></x>");
            stbuilder.Append("<div>custom box2</div>");
            stbuilder.Append("<x type=\"textbox\" id=\"my_custombox1\"></x>");
            stbuilder.Append("</body></html>");
            htmlBox.LoadHtmlString(stbuilder.ToString());
            viewport.AddContent(htmlBox);
            //==================================================

            //textbox
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);

            textbox.SetLocation(0, 200);
            viewport.AddContent(textbox);
            textbox.Focus();
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //--------------------------------
            {
                //background element
                var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
                bgbox.BackColor = Color.White;
                bgbox.SetLocation(0, 0);
                SetupBackgroundProperties(bgbox);
                viewport.AddContent(bgbox);
            }
            //--------------------------------
            //ninespace compartment
            ninespaceBox = new NinespaceBox(800, 600);
            ninespaceBox.ShowGrippers = true;
            viewport.AddContent(ninespaceBox);
            ninespaceBox.SetSize(800, 600);
            //--------------------------------


            //--------------------------------
            //test add some content to the ninespace box
            var sampleListView = CreateSampleListView();
            ninespaceBox.LeftSpace.ContentLayoutKind = BoxContentLayoutKind.VerticalStack;
            ninespaceBox.LeftSpace.AddChild(sampleListView);
        }
Exemple #6
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true);
            textbox.SetLocation(20, 20);
            var style1 = new Text.TextSpanStyle();

            style1.FontInfo          = new PixelFarm.Drawing.RequestFont("tahoma", 10);
            style1.FontColor         = new PixelFarm.Drawing.Color(0, 0, 0);
            textbox.DefaultSpanStyle = style1;

            var textSplitter = new CustomWidgets.ContentTextSplitter();

            textbox.TextSplitter = textSplitter;
            sgBox = new SuggestionWindowMx(300, 200);
            sgBox.UserConfirmSelectedItem += new EventHandler(sgBox_UserConfirmSelectedItem);
            sgBox.ListItemKeyboardEvent   += new EventHandler <UIKeyEventArgs>(sgBox_ListItemKeyboardEvent);
            sgBox.Hide();
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();

            textSurfaceListener.CharacterAdded      += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved    += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            textbox.TextEventListener = textSurfaceListener;
            //------------------------------------

            viewport.AddContent(textbox);
            viewport.AddContent(sgBox.GetPrimaryUI());
            //------------------------------------
            BuildSampleCountryList();
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true);
            textbox.SetLocation(20, 20);
            var textSplitter = new CustomWidgets.ContentTextSplitter();
            textbox.TextSplitter = textSplitter;
            sgBox = new SuggestionWindowMx(300, 200);
            sgBox.UserConfirmSelectedItem += new EventHandler(sgBox_UserConfirmSelectedItem);
            sgBox.ListItemKeyboardEvent += new EventHandler<UIKeyEventArgs>(sgBox_ListItemKeyboardEvent);
            sgBox.Hide();
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();
            textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            textbox.TextEventListener = textSurfaceListener;
            //------------------------------------ 

            viewport.AddContent(textbox);
            viewport.AddContent(sgBox.GetPrimaryUI());
            //------------------------------------ 
            BuildSampleCountryList();
        }
        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)
        {
            //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);
            }
        }
Exemple #10
0
        public void StartModule(LayoutFarm.SampleViewport sampleViewport)
        {
            this.viewport = sampleViewport;
            dzBoardModule = new DesignBoardModule();

            menuModule = new MenuBoardModule();
            menuModule.menuItemClick += new EventHandler <MenuItemClickEventArgs>(menuModule_menuItemClick);


            var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();

            contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
            //app specific here
            documentRootPath = System.Windows.Forms.Application.ExecutablePath;

            this.htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                                                                 (s, e) => contentMx.AddRequestImage(e.ImageBinder),
                                                                 contentMx_LoadStyleSheet);

            //1. design board
            dzBoardModule.StartModule(htmlHost, this.viewport);
            ////2. canvas board
            //drawingBoard.StartModule(htmlHost, this.viewport);
            //3. menu
            menuModule.StartModule(htmlHost, this.viewport);

            //------------------------------------------------------
            //context knowledge***
            //------------------------------------------------------
        }
Exemple #11
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)
        {
            this.viewport = viewport;
            {
                animationBoard           = new SimpleBox(800, 800);
                animationBoard.BackColor = PixelFarm.Drawing.Color.White;
                viewport.AddContent(animationBoard);
            }
            //
            {
                List <PennerAnimationInfo> pennerAnimationList = LoadAllPennerAnimationList();
                ListView easingFuncs_List = new ListView(200, 850);
                easingFuncs_List.SetLocation(600, 20);
                viewport.AddContent(easingFuncs_List);
                easingFuncs_List.ListItemMouseEvent += (s, e) =>
                {
                    //do animation
                    PennerAnimationInfo animation = pennerAnimationList[easingFuncs_List.SelectedIndex];
                    //
                    GenerateAnimation(animation._generatorDelegate);
                };

                //add item
                foreach (PennerAnimationInfo pennerAnimation in pennerAnimationList)
                {
                    ListItem listItem = new ListItem(200, 20);
                    listItem.Text = pennerAnimation._name;
                    listItem.Tag  = pennerAnimation;
                    easingFuncs_List.AddItem(listItem);
                }
            }
        }
        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 listview = new LayoutFarm.CustomWidgets.ListView(300, 400);

            listview.SetLocation(10, 10);
            listview.BackColor = KnownColors.FromKnownColor(KnownColor.LightGray);
            //add list view to viewport
            viewport.AddContent(listview);
            //add
            RequestFont listItemFont = new RequestFont("tahoma", 18);

            for (int i = 0; i < 10; ++i)
            {
                var listItem = new LayoutFarm.CustomWidgets.ListItem(400, 20);
                if ((i % 2) == 0)
                {
                    listItem.BackColor = KnownColors.FromKnownColor(KnownColor.OrangeRed);
                }
                else
                {
                    listItem.BackColor = KnownColors.FromKnownColor(KnownColor.Orange);
                }
                listItem.SetFont(listItemFont);
                listItem.Text = "A" + i;
                listview.AddItem(listItem);
            }
        }
Exemple #15
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false);

            viewport.AddContent(textbox);
            textbox.InvalidateGraphics();
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var textbox1 = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);
            var style1   = new Text.TextSpanStyle();

            style1.FontInfo = new PixelFarm.Drawing.RequestFont("tahoma", 18);
            //test with various font style
            style1.FontColor          = new PixelFarm.Drawing.Color(255, 0, 0);
            textbox1.DefaultSpanStyle = style1;
            viewport.AddContent(textbox1);
            //-------------------
            //this version we need to set a style font each textbox
            var textbox2 = new LayoutFarm.CustomWidgets.TextBox(400, 500, true);
            var style2   = new Text.TextSpanStyle();

            style2.FontInfo           = new PixelFarm.Drawing.RequestFont("tahoma", 10);
            style2.FontColor          = new PixelFarm.Drawing.Color(0, 0, 0);
            textbox2.DefaultSpanStyle = style2;
            textbox2.SetLocation(20, 120);


            viewport.AddContent(textbox2);
            var textSplitter = new ContentTextSplitter();

            textbox2.TextSplitter = textSplitter;
            textbox2.Text         = "Hello World!";
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //--------------------------------
            {
                //background element
                var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
                bgbox.BackColor = Color.White;
                bgbox.SetLocation(0, 0);
                SetupBackgroundProperties(bgbox);
                viewport.AddContent(bgbox);
            }
            //--------------------------------
            //ninespace compartment
            ninespaceBox = new NinespaceBox(800, 600);
            ninespaceBox.ShowGrippers = true;
            viewport.AddContent(ninespaceBox);
            ninespaceBox.SetSize(800, 600);
            //--------------------------------


            //--------------------------------
            //test add some content to the ninespace box
            var sampleListView = CreateSampleListView();

            ninespaceBox.LeftSpace.ContentLayoutKind = BoxContentLayoutKind.VerticalStack;
            ninespaceBox.LeftSpace.AddChild(sampleListView);
        }
Exemple #18
0
        HtmlBoxes.HtmlHost GetHtmlHost(SampleViewport viewport)
        {
            if (htmlHost == null)
            {
                htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                                                                //1. img request
                                                                (s, e) =>
                {
                    //load resource -- sync or async?
                    string absolutePath = imgFolderPath + "\\" + e.ImageBinder.ImageSource;
                    if (!System.IO.File.Exists(absolutePath))
                    {
                        return;
                    }

                    //load create and load bitmap
                    e.ImageBinder.SetImage(LoadBitmap(absolutePath));
                },
                                                                //2. stylesheet request
                                                                (s, e) =>
                {
                });
            }
            return(htmlHost);
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true);
            textbox.SetLocation(20, 20);

            var style1 = new Text.TextSpanStyle();

            style1.FontInfo          = new PixelFarm.Drawing.RequestFont("tahoma", 10);
            style1.FontColor         = new PixelFarm.Drawing.Color(0, 0, 0);
            textbox.DefaultSpanStyle = style1;

            var textSplitter = new LayoutFarm.CustomWidgets.ContentTextSplitter();

            textbox.TextSplitter = textSplitter;
            listView             = new CustomWidgets.ListView(300, 200);
            listView.SetLocation(0, 40);
            listView.Visible = false;
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();

            textSurfaceListener.CharacterAdded      += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved    += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            textbox.TextEventListener = textSurfaceListener;
            //------------------------------------
            viewport.AddContent(textbox);
            viewport.AddContent(listView);
            //------------------------------------
            BuildSampleCountryList();
        }
        HtmlBoxes.HtmlHost GetHtmlHost(SampleViewport viewport)
        {
            if (htmlHost == null)
            {
                htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                    //1. img request
                    (s, e) =>
                    {
                        //load resource -- sync or async? 
                        string absolutePath = imgFolderPath + "\\" + e.ImageBinder.ImageSource;
                        if (!System.IO.File.Exists(absolutePath))
                        {
                            return;
                        }

                        //load create and load bitmap                         
                        e.ImageBinder.SetImage(LoadBitmap(absolutePath));
                    },
                    //2. stylesheet request
                    (s, e) =>
                    {
                    });
            }
            return htmlHost;
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //--------------------------------
            {
                //background element
                var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight);
                bgbox.BackColor = Color.White;
                bgbox.SetLocation(0, 0);
                SetupBackgroundProperties(bgbox);
                viewport.AddContent(bgbox);
            }
            //--------------------------------
            //ninespace compartment
            ninespaceBox = new NinespaceBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight - 15);
            ninespaceBox.ShowGrippers = true;
            var ninespace2 = new NinespaceBox(400, 600);
            ninespace2.SetLeftSpaceWidth(150);
            ninespace2.ShowGrippers = true;
            ninespaceBox.RightSpace.AddChild(ninespace2);
            viewport.AddContent(ninespaceBox);
            // ninespaceBox.SetSize(800, 600);

            ////test add some content to the ninespace box
            //var sampleListView = CreateSampleListView();
            //ninespaceBox.LeftSpace.PanelLayoutKind = PanelLayoutKind.VerticalStack;
            //ninespaceBox.LeftSpace.AddChildBox(sampleListView);

        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //--------------------------------
            {
                //background element
                var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight);
                bgbox.BackColor = Color.White;
                bgbox.SetLocation(0, 0);
                SetupBackgroundProperties(bgbox);
                viewport.AddContent(bgbox);
            }
            //--------------------------------
            //ninespace compartment
            ninespaceBox = new NinespaceBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight - 15);
            ninespaceBox.ShowGrippers = true;


            var ninespace2 = new NinespaceBox(400, 600);

            ninespace2.SetLeftSpaceWidth(150);
            ninespace2.ShowGrippers = true;
            ninespaceBox.RightSpace.AddChild(ninespace2);


            viewport.AddContent(ninespaceBox);
            // ninespaceBox.SetSize(800, 600);

            ////test add some content to the ninespace box
            //var sampleListView = CreateSampleListView();
            //ninespaceBox.LeftSpace.PanelLayoutKind = PanelLayoutKind.VerticalStack;
            //ninespaceBox.LeftSpace.AddChildBox(sampleListView);
        }
        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);
        }
        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);
            }
        }
Exemple #25
0
        public virtual void OnStartDemo(SampleViewport viewport)
        {
            //html box
            var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();

            contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;


            var host = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                                                            (s, e) => contentMx.AddRequestImage(e.ImageBinder),
                                                            contentMx_LoadStyleSheet);

            //1. htmlbox
            int viewportW = viewport.ViewportControl.Width;
            int viewportH = viewport.ViewportControl.Height;

            htmlBox = new HtmlBox(host, viewportW, viewportH);
            viewport.AddContent(htmlBox);



            if (htmltext == null)
            {
                htmltext = @"<html><head></head><body>NOT FOUND!</body></html>";
            }

            htmlBox.LoadHtmlString(htmltext);
        }
        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);
            //-------------------------------------------------------------------

        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     imageContentMan.ImageLoadingRequest += (s, e) =>
     {
         e.SetResultImage(LoadBitmap(e.ImagSource));
     };
     AddScrollView1(viewport, 0, 0);
     AddScrollView2(viewport, 250, 0);
 }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     imageContentMan.ImageLoadingRequest += (s, e) =>
     {
         e.SetResultImage(LoadBitmap(e.ImagSource));
     };
     AddScrollView1(viewport, 0, 0);
     //AddScrollView2(viewport, 250, 0);
 }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var sampleButton = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);
     viewport.AddContent(sampleButton);
     int count = 0;
     sampleButton.MouseDown += new EventHandler<UIMouseEventArgs>((s, e2) =>
     {
         Console.WriteLine("click :" + (count++));
     });
 }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var bgRenderBox = new CustomRenderBox(viewport.Root, 800, 600);
     bgRenderBox.BackColor = Color.LightGray;
     viewport.AddContent(bgRenderBox);
     //---------------------------------------------------------------------
     var miniAggg = new MyMiniAggCanvasRenderElement(viewport.Root, 400, 600);
     var lionFill = new PixelFarm.Agg.LionFillSprite();
     miniAggg.AddSprite(lionFill);
     viewport.AddContent(miniAggg);
 }
 static void SetupImageList(SampleViewport viewport)
 {
     if (!LayoutFarm.CustomWidgets.ResImageList.HasImages)
     {
         //set imagelists
         var imgdic = new Dictionary <CustomWidgets.ImageName, Image>();
         imgdic[CustomWidgets.ImageName.CheckBoxUnChecked] = viewport.LoadImage("../../Data/imgs/arrow_close.png");
         imgdic[CustomWidgets.ImageName.CheckBoxChecked]   = viewport.LoadImage("../../Data/imgs/arrow_open.png");
         LayoutFarm.CustomWidgets.ResImageList.SetImageList(imgdic);
     }
 }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     for (int i = 0; i < 10; ++i)
     {
         Label label = new Label(17, 50);
         label.SetLocation(0, i * 20);
         label.Color = PixelFarm.Drawing.Color.Black;
         label.Text = "ABCDEFGHIJKLMNOPQRSTUVWXZYZ0123456789";
         viewport.AddContent(label);
     } 
 }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var sampleButton = new LayoutFarm.CustomWidgets.SimpleBox(30, 30);

            viewport.AddContent(sampleButton);
            int count = 0;

            sampleButton.MouseDown += new EventHandler <UIMouseEventArgs>((s, e2) =>
            {
                Console.WriteLine("click :" + (count++));
            });
        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var comboBox1 = CreateComboBox(20, 20);
     viewport.AddContent(comboBox1);
     var comboBox2 = CreateComboBox(50, 50);
     viewport.AddContent(comboBox2);
     //------------
     var menuItem = CreateMenuItem(50, 100);
     var menuItem2 = CreateMenuItem(5, 5);
     menuItem.AddSubMenuItem(menuItem2);
     viewport.AddContent(menuItem);
 }
        protected override void OnStartDemo(SampleViewport viewport)
        {

            ImageBinder imgBinder = viewport.GetImageBinder2("../../Data/imgs/favorites32.png");
            for (int i = 0; i < 100; ++i)
            {
                //share 1 img binder with multiple img boxes
                var imgBox = new CustomWidgets.ImageBox(imgBinder.Image.Width, imgBinder.Image.Height);
                imgBox.ImageBinder = imgBinder;
                imgBox.SetLocation(i * 10, i * 10);
                viewport.AddContent(imgBox);
            }
        }
Exemple #36
0
 HtmlBoxes.HtmlHost GetHtmlHost(SampleViewport viewport)
 {
     if (htmlHost == null)
     {
         htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
         var htmlBoxContentMx = new HtmlHostContentManager();
         var contentMx        = new LayoutFarm.ContentManagers.ImageContentManager();
         contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
         htmlBoxContentMx.AddImageContentMan(contentMx);
         htmlBoxContentMx.Bind(htmlHost);
     }
     return(htmlHost);
 }
Exemple #37
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var bgRenderBox = new CustomRenderBox(viewport.Root, 800, 600);

            bgRenderBox.BackColor = Color.LightGray;
            viewport.AddContent(bgRenderBox);
            //---------------------------------------------------------------------
            var miniAggg = new MyMiniAggCanvasRenderElement(viewport.Root, 400, 600);
            var lionFill = new PixelFarm.Agg.LionFillSprite();

            miniAggg.AddSprite(lionFill);
            viewport.AddContent(miniAggg);
        }
 HtmlBoxes.HtmlHost GetHtmlHost(SampleViewport viewport)
 {
     if (htmlHost == null)
     {
         htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
         var htmlBoxContentMx = new HtmlHostContentManager();
         var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();
         contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
         htmlBoxContentMx.AddImageContentMan(contentMx);
         htmlBoxContentMx.Bind(htmlHost);
     }
     return htmlHost;
 }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var textbox1 = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);
     var style1 = new Text.TextSpanStyle();
     style1.FontInfo = new PixelFarm.Drawing.RequestFont("tahoma", 10);// viewport.P.GetFont("tahoma", 10, PixelFarm.Drawing.FontStyle.Regular);
     textbox1.DefaultSpanStyle = style1;
     viewport.AddContent(textbox1);
     var textbox2 = new LayoutFarm.CustomWidgets.TextBox(400, 500, true);
     textbox2.SetLocation(20, 120);
     viewport.AddContent(textbox2);
     var textSplitter = new ContentTextSplitter(); 
     textbox2.TextSplitter = textSplitter;
     textbox2.Text = "Hello World!";
 }
 public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
     EventHandler<ContentManagers.ImageRequestEventArgs> imageReqHandler,
     EventHandler<ContentManagers.TextRequestEventArgs> textReq)
 {
     HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost();
     htmlhost.SetRootGraphics(sampleViewport.Root);
     htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));
     htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
     htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
     {
         sampleViewport.Root.AddToUpdateQueue(htmlCont);
     });
     return htmlhost;
 }
Exemple #41
0
        public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
                                                        EventHandler <ContentManagers.ImageRequestEventArgs> imageReqHandler,
                                                        EventHandler <ContentManagers.TextRequestEventArgs> textReq)
        {
            HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost(sampleViewport.P);
            htmlhost.SetRootGraphics(sampleViewport.Root);
            htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));

            htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
            htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
            {
                sampleViewport.Root.AddToUpdateQueue(htmlCont);
            });
            return(htmlhost);
        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     this.viewport = viewport;
     this.htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
     SetupHtmlMenuBox();
     //==================================================
     //box1 test area
     //html box
     this.testHtmlBox = new HtmlBox(htmlhost, 800, 400);
     testHtmlBox.SetLocation(30, 50);
     viewport.AddContent(testHtmlBox);
     string html = @"<html><head></head><body><div id='div1'>OK1</div><div>OK2</div></body></html>";
     testHtmlBox.LoadHtmlString(html);
     //==================================================  
 }
Exemple #43
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);
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            var comboBox1 = CreateComboBox(20, 20);

            viewport.AddContent(comboBox1);
            var comboBox2 = CreateComboBox(50, 50);

            viewport.AddContent(comboBox2);
            //------------
            var menuItem  = CreateMenuItem(50, 100);
            var menuItem2 = CreateMenuItem(5, 5);

            menuItem.AddSubMenuItem(menuItem2);
            viewport.AddContent(menuItem);
        }
Exemple #45
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            this.htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            SetupHtmlMenuBox();
            //==================================================
            //box1 test area
            //html box
            this.testHtmlBox = new HtmlBox(htmlhost, 800, 400);
            testHtmlBox.SetLocation(30, 50);
            viewport.AddContent(testHtmlBox);
            string html = @"<html><head></head><body><div id='div1'>OK1</div><div>OK2</div></body></html>";

            testHtmlBox.LoadHtmlString(html);
            //==================================================
        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var appPath = System.Windows.Forms.Application.ExecutablePath;
     int pos = appPath.IndexOf("\\bin\\");
     if (pos > -1)
     {
         string sub01 = appPath.Substring(0, pos);
         imgFolderPath = sub01 + "\\images";
     }
     //==================================================
     //html box
     var htmlBox = new HtmlBox(GetHtmlHost(viewport), 800, 600);
     viewport.AddContent(htmlBox);
     string html = "<html><head></head><body><div>OK1</div><div>3 Images</div><img src=\"sample01.png\"></img><img src=\"sample01.png\"></img><img src=\"sample01.png\"></img></body></html>";
     htmlBox.LoadHtmlString(html);
 }
Exemple #47
0
 protected override void OnStartDemo(SampleViewport viewport)
 {
     //--------------------------------
     {
         //background element
         var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
         bgbox.BackColor = Color.White;
         bgbox.SetLocation(0, 0);
         SetupBackgroundProperties(bgbox);
         viewport.AddContent(bgbox);
     }
     //--------------------------------
     //ninespace compartment
     ninespaceBox = new UINinespaceBox(800, 600);
     viewport.AddContent(ninespaceBox);
     ninespaceBox.SetSize(800, 600);
 }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //html box
            var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();
            contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
            var host = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                (s, e) => contentMx.AddRequestImage(e.ImageBinder),
                contentMx_LoadStyleSheet);
            htmlBox = new HtmlBox(host, 1024, 800);
            viewport.AddContent(htmlBox);
            if (htmltext == null)
            {
                htmltext = @"<html><head></head><body>NOT FOUND!</body></html>";
            }

            htmlBox.LoadHtmlString(htmltext);
        }
        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);
        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     //--------------------------------
     {
         //background element
         var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
         bgbox.BackColor = Color.White;
         bgbox.SetLocation(0, 0);
         SetupBackgroundProperties(bgbox);
         viewport.AddContent(bgbox);
     }
     //--------------------------------
     //ninespace compartment
     ninespaceBox = new UINinespaceBox(800, 600);
     viewport.AddContent(ninespaceBox);
     ninespaceBox.SetSize(800, 600);
 }
Exemple #51
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            ////==================================================
            //html box
            var htmlBox = new HtmlBox(htmlhost, 800, 400);
            htmlBox.SetLocation(30, 30);
            viewport.AddContent(htmlBox);
            string html = @"<html><head></head><body><div>OK1</div><div>OK2</div></body></html>";
            htmlBox.LoadHtmlString(html);
            //================================================== 

            //textbox
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);
            textbox.SetLocation(0, 200);
            viewport.AddContent(textbox);
            textbox.Focus();
        }
 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)
 {
     htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
     ////==================================================
     //html box
     {
         HtmlBox lightHtmlBox = new HtmlBox(htmlHost, 800, 50);
         lightHtmlBox.SetLocation(50, 450);
         viewport.AddContent(lightHtmlBox);
         //light box can't load full html
         //all light boxs of the same lightbox host share resource with the host
         string html = @"<div>OK1</div><div>OK2</div>";
         //if you want to use full html-> use HtmlBox instead  
         lightHtmlBox.LoadHtmlFragmentString(html);
     }
     //==================================================  
     {
         HtmlBox lightHtmlBox2 = new HtmlBox(htmlHost, 800, 50);
         lightHtmlBox2.SetLocation(0, 60);
         viewport.AddContent(lightHtmlBox2);
         //light box can't load full html
         //all light boxs of the same lightbox host share resource with the host
         string html2 = @"<div>OK3</div><div>OK4</div>";
         //if you want to use ful l html-> use HtmlBox instead  
         lightHtmlBox2.LoadHtmlFragmentString(html2);
     }
     //==================================================  
     {
         HtmlBox lightHtmlBox3 = new HtmlBox(htmlHost, 800, 50);
         lightHtmlBox3.SetLocation(0, 100);
         viewport.AddContent(lightHtmlBox3);
         //fragment dom 
         //create dom then to thie light box
         lightHtmlBox3.LoadHtmlDom(CreateSampleHtmlDoc());
     }
     //================================================== 
     //textbox
     var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 150, true);
     textbox.SetLocation(0, 200);
     viewport.AddContent(textbox);
     textbox.Focus();
 }
        public virtual void OnViewportReady(SampleViewport viewport)
        {
            //html box
            var contentMx = new LayoutFarm.ContentManagers.ImageContentManager();
            contentMx.ImageLoadingRequest += contentMx_ImageLoadingRequest;
            var host = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
                (s, e) => contentMx.AddRequestImage(e.ImageBinder),
                contentMx_LoadStyleSheet);
            //1. htmlbox
            int viewportW = viewport.ViewportControl.Width;
            int viewportH = viewport.ViewportControl.Height;
            htmlBox = new HtmlBox(host, viewportW, viewportH);
            viewport.AddContent(htmlBox);
            if (htmltext == null)
            {
                htmltext = @"<html><head></head><body>NOT FOUND!</body></html>";
            }

            htmlBox.LoadHtmlString(htmltext);
        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var listview = new LayoutFarm.CustomWidgets.ListView(300, 400);
     listview.SetLocation(10, 10);
     listview.BackColor = KnownColors.FromKnownColor(KnownColor.LightGray);
     viewport.AddContent(listview);
     //add 
     for (int i = 0; i < 10; ++i)
     {
         var listItem = new LayoutFarm.CustomWidgets.ListItem(400, 20);
         if ((i % 2) == 0)
         {
             listItem.BackColor = KnownColors.FromKnownColor(KnownColor.OrangeRed);
         }
         else
         {
             listItem.BackColor = KnownColors.FromKnownColor(KnownColor.Orange);
         }
         listview.AddItem(listItem);
     }
 }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            var treeView = new LayoutFarm.CustomWidgets.TreeView(300, 400);
            treeView.SetLocation(10, 10);
            treeView.BackColor = KnownColors.FromKnownColor(KnownColor.LightGray);
            viewport.AddContent(treeView);
            //prepare node icon

            ImageBinder nodeOpen = new ClientImageBinder(null);
            nodeOpen.SetImage(LoadBitmap("../../Demo/arrow_open.png"));

            //add 
            for (int i = 0; i < 10; ++i)
            {
                var childLevel0 = new LayoutFarm.CustomWidgets.TreeNode(400, 40);
                childLevel0.BackColor = ((i % 2) == 0) ?
                         KnownColors.FromKnownColor(KnownColor.Blue) :
                         KnownColors.FromKnownColor(KnownColor.Yellow);
                treeView.AddItem(childLevel0);
                childLevel0.NodeIconImage = nodeOpen;
                for (int n = 0; n < 4; ++n)
                {
                    var childLevel1 = new LayoutFarm.CustomWidgets.TreeNode(400, 20);
                    childLevel1.BackColor = ((n % 2) == 0) ?
                          KnownColors.FromKnownColor(KnownColor.Green) :
                          KnownColors.FromKnownColor(KnownColor.YellowGreen);
                    childLevel0.AddChildNode(childLevel1);
                    childLevel1.NodeIconImage = nodeOpen;
                    for (int m = 0; m < 5; ++m)
                    {
                        var childLevel2 = new LayoutFarm.CustomWidgets.TreeNode(400, 20);
                        childLevel2.BackColor = ((m % 2) == 0) ?
                          KnownColors.FromKnownColor(KnownColor.OrangeRed) :
                          KnownColors.FromKnownColor(KnownColor.Wheat);
                        childLevel2.NodeIconImage = nodeOpen;
                        childLevel1.AddChildNode(childLevel2);
                    }
                }
            }
        }
 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)
        {
            //--------------------------------
            {
                //background element
                var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600);
                bgbox.BackColor = Color.White;
                bgbox.SetLocation(0, 0);
                SetupBackgroundProperties(bgbox);
                viewport.AddContent(bgbox);
            }
            //--------------------------------
            //ninespace compartment
            ninespaceBox = new UINinespaceBox(800, 600);
            viewport.AddContent(ninespaceBox);
            ninespaceBox.SetSize(800, 600);
            //--------------------------------
            //test add some content to the ninespace box


            textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false);
            listView = new CustomWidgets.ListView(300, 200);
            listView.SetLocation(0, 40);
            listView.Visible = false;
            //------------------------------------
            //create special text surface listener
            var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();
            textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList();
            textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList();
            textSurfaceListener.PreviewArrowKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
            textSurfaceListener.PreviewEnterKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
            textbox.TextEventListener = textSurfaceListener;
            //------------------------------------ 

            //------------------------------------ 
            BuildSampleCountryList();
            ninespaceBox.LeftSpace.AddChild(textbox);
            ninespaceBox.RightSpace.AddChild(listView);
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            ////==================================================
            //html box
            var htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null);
            var htmlBox = new HtmlBox(htmlHost, 800, 400);
            StringBuilder stbuilder = new StringBuilder();
            stbuilder.Append("<html><head></head><body>");
            stbuilder.Append("<div>custom box1</div>");
            stbuilder.Append("<x id=\"my_custombox1\"></x>");
            stbuilder.Append("<div>custom box2</div>");
            stbuilder.Append("<x type=\"textbox\" id=\"my_custombox1\"></x>");
            stbuilder.Append("</body></html>");
            htmlBox.LoadHtmlString(stbuilder.ToString());
            viewport.AddContent(htmlBox);
            //==================================================  

            //textbox
            var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true);
            textbox.SetLocation(0, 200);
            viewport.AddContent(textbox);
            textbox.Focus();
        }
 protected override void OnStartDemo(SampleViewport viewport)
 {
     textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true);
     textbox.SetLocation(20, 20);
     var textSplitter = new LayoutFarm.CustomWidgets.ContentTextSplitter();
     textbox.TextSplitter = textSplitter;
     listView = new CustomWidgets.ListView(300, 200);
     listView.SetLocation(0, 40);
     listView.Visible = false;
     //------------------------------------
     //create special text surface listener
     var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener();
     textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList();
     textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList();
     textSurfaceListener.PreviewArrowKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown);
     textSurfaceListener.PreviewEnterKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown);
     textbox.TextEventListener = textSurfaceListener;
     //------------------------------------ 
     viewport.AddContent(textbox);
     viewport.AddContent(listView);
     //------------------------------------ 
     BuildSampleCountryList();
 }