예제 #1
0
        protected override void Initialize()
        {
            base.Initialize();

            //create a bunch of UI elements and link them to the state
            ScrollPanel panel = new ScrollPanel(0, 0, 0, 400, 640, this);
            panel.SetBackgroundColor(Color4.Red);
            ScrollPanel panel2 = new ScrollPanel(420, 10, 0, 350, 500, this);

            panel.SetContentDimensions(800, 800);
            panel2.SetContentDimensions(400, 400);

            Button button = new Button(10, 50, 0, 100, 100, "button.png", "button", this);
            TextField field = new TextField(10, 10, 0, 100, this);
            ListBox listBox = new ListBox(120, 10, 0, 200, 150, 10, this);

            DropDownBox dropDown = new DropDownBox(50, 420, 0, 100, this);

            TextBox textBox = new TextBox(10, 10, 0, 400, 400, this);
            RadioButton radio = new RadioButton(200, 420, 0, this);

            panel.AddControl(panel2);

            panel.AddControl(dropDown);
            panel.AddControl(textBox);
            panel.AddControl(radio);

            panel2.AddControl(button);
            panel2.AddControl(field);
            panel2.AddControl(listBox);

            this.AddControl(panel);
        }
예제 #2
0
 public VerticalScrollBar(ScrollPanel parent, int scrollAmount, State state)
     : base(parent.GetBodyRect().Right - 20, parent.GetBodyRect().Y, 0, 20, parent.GetBodyRect().Height, state)
 {
     _backgroundColor = Color4.LightGray;
     _scrollParent = parent;
     _slider = new Rectangle(_content.X, _content.Y, _content.Width, _content.Height);
     this.SetScrollAmount(scrollAmount);
     _grabbed = false;
 }