예제 #1
0
        //------------------------------------------------------
        //------------------------Methods-----------------------
        //------------------------------------------------------

        public void Move(Point amountToMove)
        {
            Bounds = new Rectangle(Bounds.X + amountToMove.X, Bounds.Y + amountToMove.Y, Bounds.Width, Bounds.Height);

            _dropDownButton.Move(amountToMove);

            for (int i = 0; i < itemsBounds.Count; i++)
            {
                itemsBounds[i] = new Rectangle(itemsBounds[i].X + amountToMove.X, itemsBounds[i].Y + amountToMove.Y, itemsBounds[i].Width, itemsBounds[i].Height);
            }

            if (_scroller != null)
            {
                _scroller.Move(amountToMove);
            }
        }
예제 #2
0
        public override void Run(Window window)
        {
            //Conformant conformant = new Conformant(window);
            //conformant.Show();
            Box outterBox = new Box(window)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsHorizontal = false,
            };

            outterBox.Show();

            var button = new Button(window)
            {
                Text  = "Button1",
                Color = Color.White,
            };

            button.Show();
            button.Resize(200, 100);
            button.Move(300, 100);

            var button2 = new Button(window)
            {
                Text  = "Button2",
                Color = Color.White,
            };

            button2.Show();
            button2.Resize(200, 100);
            button2.Move(300, 300);

            var button3 = new Button(window)
            {
                Text  = "Button3",
                Color = Color.White,
            };

            button3.Show();
            button3.Resize(200, 100);
            button3.Move(300, 500);

            Scroller scroller = new Scroller(window);

            scroller.Show();
            scroller.Resize(200, 400);
            scroller.Move(100, 600);

            Box box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            box.Show();
            scroller.SetContent(box);

            var rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                int   r         = rnd.Next(255);
                int   g         = rnd.Next(255);
                int   b         = rnd.Next(255);
                Color color     = Color.FromRgb(r, g, b);
                var   colorBox1 = new Label(window)
                {
                    Text            = "Label" + i.ToString(),
                    BackgroundColor = color,
                    MinimumHeight   = 40,
                };
                colorBox1.Show();
                box.PackEnd(colorBox1);
            }

            Scroller scroller2 = new Scroller(window);

            scroller2.Show();
            scroller2.Resize(200, 400);
            scroller2.Move(700, 600);

            Box box2 = new Box(window)
            {
                MinimumWidth  = 400,
                MinimumHeight = 200,
            };

            box2.BackgroundColor = Color.White;
            box2.Show();
            scroller2.SetContent(box2);

            rnd = new Random();
            for (int i = 0; i < 20; i++)
            {
                int   r         = rnd.Next(255);
                int   g         = rnd.Next(255);
                int   b         = rnd.Next(255);
                Color color     = Color.FromRgb(r, g, b);
                var   colorBox2 = new Label(scroller2)
                {
                    BackgroundColor = color,
                    MinimumHeight   = 40,
                    Text            = "GOGOGO"
                };
                colorBox2.Show();
                box2.PackEnd(colorBox2);
            }

            //conformant.SetContent(outterBox);
            //outterBox.PackEnd(button);
            //outterBox.PackEnd(button2);
            //outterBox.PackEnd(button3);
            //outterBox.PackEnd(scroller);
            //outterBox.PackEnd(scroller2);

            //outterBox.SetLayoutCallback(() =>
            //{
            //    scroller.Move(100, 800);
            //    button.Move(300, 100);
            //    button2.Move(300, 300);
            //    button3.Move(300, 500);
            //    scroller2.Move(700, 800);
            //});
        }
예제 #3
0
        /// <summary>
        /// Instantiates the <see cref="RedBoxDialog"/>.
        /// </summary>
        /// <param name="onClick">
        /// Action to take when primary button is clicked.
        /// </param>
        public RedBoxDialog(Action onClick)
        {
            _onClick = onClick;
            DispatcherHelpers.RunOnDispatcher(() =>
            {
                if (redboxTitle == null)
                {
                    redboxTitle = new ReactTextView(ReactProgram.RctWindow)
                    {
                        AlignmentX      = -1,
                        AlignmentY      = -1,
                        WeightX         = 1,
                        WeightY         = 1,
                        BackgroundColor = Color.Red,
                        MinimumHeight   = 120,
                    };
                    redboxTitle.Resize(1160, 120);
                    redboxTitle.Move(240, 60);
                }

                if (reloadBg == null)
                {
                    reloadBg = new ReactTextView(ReactProgram.RctWindow)
                    {
                        AlignmentX      = -1,
                        AlignmentY      = -1,
                        WeightX         = 1,
                        WeightY         = 1,
                        BackgroundColor = Color.Red,
                        MinimumHeight   = 120,
                    };
                    reloadBg.Resize(280, 120);
                    reloadBg.Move(1400, 60);
                }

                if (reloadBtn == null)
                {
                    reloadBtn = new Button(ReactProgram.RctWindow)
                    {
                        Text = "<span color=#000000>Reload JS</span>",
                    };
                    reloadBtn.SetPartColor("bg", Color.FromRgb(120, 120, 120));
                    reloadBtn.Resize(160, 60);
                    reloadBtn.Move(1450, 90);
                    reloadBtn.Clicked += (s, e) =>
                    {
                        _onClick();
                    };
                }

                if (background == null)
                {
                    background = new Box(ReactProgram.RctWindow)
                    {
                        AlignmentX = -1,
                        AlignmentY = -1,
                        WeightX    = 1,
                        WeightY    = 1
                    };
                }

                if (scroller == null)
                {
                    scroller = new Scroller(ReactProgram.RctWindow)
                    {
                        AlignmentX  = -1,
                        AlignmentY  = -1,
                        WeightX     = 1,
                        WeightY     = 1,
                        ScrollBlock = ScrollBlock.None
                    };
                    scroller.BackgroundColor = Color.Red;
                    background.SetContent(scroller);
                    background.SetLayoutCallback(() =>
                    {
                        scroller.Resize(1440, 840);
                        scroller.Move(240, 180);
                    });
                }

                if (scrollBox == null)
                {
                    scrollBox = new Box(ReactProgram.RctWindow)
                    {
                        AlignmentX = -1,
                        AlignmentY = -1,
                        WeightX    = 1,
                        WeightY    = 1
                    };
                    scroller.SetContent(scrollBox);
                }
                if (labelList == null)
                {
                    labelList = new List <ReactTextView>();
                }
            });
        }