예제 #1
0
        private void InitWindow()
        {
            var window = new UIWindow();
            window.AddConstraint(Edge.CenterY, null, Edge.CenterY, 0f, ConstraintCategory.Initialization);
            window.AddConstraint(Edge.Right, null, Edge.Right, 50f, ConstraintCategory.Initialization);

            var contentPanel = new UIScrollWindow(UIScrollWindow.ScrollBarMode.Both);
            contentPanel.AddConstraint(Edge.Dock, window.BodyPanel, Edge.Dock);

            var img = new UIImage("graphics/map");
            img.Tag = "Map";
            img.AddConstraint(Edge.TopLeft, contentPanel.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization);
            contentPanel.AddChild(img);

            window.BodyPanel.AddChild(contentPanel);
            uiManager.Add(window);
        }
예제 #2
0
        private void InitTextWindow()
        {
            UIScrollWindow textWindow = new UIScrollWindow();
            textWindow.Position = new Vector2(300, 300);
            textWindow.ScrollPanel.Restriction = ScrollRestriction.Vertical;
            textWindow.Size = new Vector2(0, 180);
            textWindow.AddConstraint(Edge.Bottom, null, Edge.Bottom, 5);
            textWindow.AddConstraint(Edge.Horizontal, null, Edge.Horizontal, 5);

            string text = NativeFile.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Lorem Ipsum.txt"));
            UILabel label = new UILabel(text, true);
            label.AddConstraint(Edge.TopLeft, textWindow.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization);
            label.AddConstraint(Edge.Right, textWindow.ScrollPanel, Edge.Right, ConstraintCategory.Initialization);
            textWindow.AddChild(label);

            uiManager.Add(textWindow);
        }