Example #1
0
        public void AddPanel(Panel p)
        {
            p.SetParent(this.ScrollPanel);

            if (this.Panels.Count > 0 && this.Panels[this.Panels.Count - 1])
            {
                p.Below(this.Panels[this.Panels.Count - 1], 3);
            }

            Panels.Add(p);

            p.SetWidth(this.ScrollPanel.Width);
            p.SetAnchorStyle(Anchors.Left | Anchors.Top | Anchors.Right);

            this.ScrollPanel.SetHeight(p.Position.Y + p.Height);
        }
Example #2
0
        public override void Init()
        {
            base.Init();

            ScrollPanel = GUIManager.Create<Panel>(this);
            ScrollPanel.SetMaterial(Utilities.White);
            ScrollPanel.SetWidth(this.Width);
            ScrollPanel.SetHeight(this.Height);
            ScrollPanel.SetAnchorStyle(Anchors.Left | Anchors.Right);

            Grip = GUIManager.Create<Panel>(this);
            Grip.SetColor(200, 201, 200);
            Grip.SetWidth(20);
            Grip.Dock(DockStyle.RIGHT);
            Grip.IsVisible = false; //We'll be drawing it manually
            Grip.OnMouseDown += new Action<Panel,OpenTK.Input.MouseButtonEventArgs>(Grip_OnMouseDown);
            this.OnMouseMove += new Action<Panel,OpenTK.Input.MouseMoveEventArgs>(ScrollBar_OnMouseMove);

            Utilities.engine.Mouse.ButtonUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(Mouse_ButtonUp);
        }