Beispiel #1
0
        public ScScrollContainer(int w, int h)
        {
            Width  = w;
            Height = h;

            wrapper          = new ScWrapper(w, h);
            wrapper.Location = new PointF(0, 0);
            Add(wrapper);

            hScrollBar                 = new ScScrollBar(8, h);
            hScrollBar.Location        = new Point(w - 8, 0);
            hScrollBar.Visible         = false;
            hScrollBar.IsHitThrough    = false;
            hScrollBar.scrollContainer = this;
            hScrollBar.SetScrollContainerMoveEvent();
            Add(hScrollBar);

            hScrollBar.SliderMoveEvent += HScrollBar_SliderMoveEvent;
            hScrollBar.SliderDownEvent += HScrollBar_SliderDownEvent;

            MouseDown += ScScrollContainer_MouseDown;
            MouseMove += ScScrollContainer_MouseMove;
            MouseUp   += ScScrollContainer_MouseUp;

            mouseHook.MouseWheel += MouseHook_MouseWheel;
            // mouseHook.Start();
        }
Beispiel #2
0
        public ScScrollContainer()
        {
            view = new ScLayer();
            Add(view);

            wrapper = new ScWrapper();
            view.Add(wrapper);

            hScrollBar                 = new ScScrollBar();
            hScrollBar.Visible         = false;
            hScrollBar.IsHitThrough    = false;
            hScrollBar.scrollContainer = this;
            hScrollBar.SetScrollContainerMoveEvent();
            Add(hScrollBar);

            hScrollBar.SliderMoveEvent += HScrollBar_SliderMoveEvent;
            hScrollBar.SliderDownEvent += HScrollBar_SliderDownEvent;

            MouseDown += ScScrollContainer_MouseDown;
            MouseMove += ScScrollContainer_MouseMove;
            MouseUp   += ScScrollContainer_MouseUp;

            mouseHook.MouseWheel += MouseHook_MouseWheel;
            // mouseHook.Start();

            SizeChanged += ScScrollContainer_SizeChanged;
        }
Beispiel #3
0
        private void ScrollContainer_ContainerMoveEvent(float yMoveValue)
        {
            ScWrapper container = scrollContainer.GetContainer();

            float yoffset = Height / container.Height * yMoveValue;
            float y       = locationSliderY - yoffset;

            if (y < 0)
            {
                y = 0;
            }
            else if (y + slider.Height > Height)
            {
                y = Height - slider.Height;
            }

            slider.Location = new PointF(slider.Location.X, y);
            Refresh();
        }